On Fri, May 19, 2006 at 03:25:43PM -0700, Chip Salzenberg wrote: : Based on what I'm seeing, the Perl 6 "type object" is the thing that claims : the primary name associated with a class. Foo::<Bar> is the type object. : The metaobject seems to be anonymous. And the package seems to be fairly : questionable... given how generic you want to be, the Perl 6 implmentation : probably can't assume that there is exactly one package associated with a : given type object, either directly or indirectly.
I think the only constraint on it is that Foo::<Bar>.meta can't point to two different objects. But .meta isn't a real method--it's more like a notation representing the "blessing", in P5 terms. Certainly different packages could share the same .meta object if the particular kind of metaobject it points to chooses to store all the state in the package rather than the metaobject. In that sense the package is just a handy place to put publicly named class state. Going the other way, $object.meta makes no guarantees that the metaobject it points to has any name. Could be completely anonymous, or an eigenclass, or whatever. Presumably metaobjects that are associated with a package can tell you that name somehow, perhaps even by stringification. But which operations can succeed through .meta will depend on what .meta.isa, as it were. In this, Perl is so OO that it even encapsulates the OO, so Perl is agnostic even about the extent to which Perl is an OO language. In Perl 6, all objects are blessed equally, but some objects are blessed more equally than others... So what's in a name? One could say that .meta is functioning more like a name sigil than like a method, and the Real Name of the metaobject is Foo::<^Bar> or some such, if it needs a name. Then maybe Foo::<Bar> is just a strange hash. Or maybe it has its own sigil. But from the viewpoint of Dorothy the programmer, it's the package that presents the public interface Oz::<Wizard>, and it's the metaobject that's trying to hide behind the metacurtain. And as in the original, sometimes the official story needs a bit of tweaking. But for now the Package of Oz is great and glorious, and doubtless you should be quaking in fear. :) All that and several bucks'll get you a Starbucks... Larry