Qua, 2008-04-30 às 15:55 +0200, TSa escreveu:
> But the type system is part of the language core.
> As such 'isa' and 'like' or assignment and binding semantics
> need a definition.

Actually, this is one of the hardest parts of implementing Perl 6,
because even 'isa', 'like', assignment and binding are dependent on the
representation of the given objects, so even such basic operations are
polymorphic.

This makes the bootstrap of the type system harder, but not impossible.
What happens is that, as it is polymorphic, I can provide known
low-level implementation of higher-level types that will interoperate
transparently with them. By doing that I can bootstrap by special-casing
the low-level implementations and getting out of the water that way.

This also allows some other interesting features, like the fact that I
may have a constant identifier that interoperates with Str while I still
can compare to of them simply by comparing their pointer addresses, or
by providing a shadow object that points to the inner data structure of
other object in order to expose the expected API.

In fact, that is the exact point that makes it possible for Perl 6 to
have a *fully* boostrapped type system. What defines native types in
Perl 6 is not that they have a incompatible lowlevel structure (because
they don't, unless optimized), but that they are the only types that the
interpreter may expect to know how they look like. Everything else
should be opaque to the interpreter (but eventually the optimizer may
have a catalog to inspect the internals directly).

Take a look at 

http://www.perlfoundation.org/perl6/index.cgi?smop_p6opaque_implementation

and at

http://www.perlfoundation.org/perl6/index.cgi?smop_oo_api

To see how that's being implemented in SMOP.

daniel

Reply via email to