'Course, I left out everything about prototype objects there...

The name Foo also (in context) represents an uninitialized object of
the class in question.  Any object, initialized or not, can get at
its type handlers by saying

    Foo.meta
    $foo.meta

and, in fact, the Foo.^bar syntax is just short for Foo.meta.bar.

The Foo object maybe therefore be used to reason about objects of
a class, but the Foo object itself is not the class.  Foo.meta is
the real class object.  Foo itself is just a Foo that hasn't been
defined yet.  Foo.isa(Class) is false, because there's no Class
type in Perl 6 as far as Perl 6 is concerned.  The type of metaobject
Foo.meta might be called "Class" if that's what the metaobject protocol
decides it should be, but Perl the Language doesn't care.  If so,
then Foo.meta.isa(Class) would be true.  But Foo.isa(Class) is still
false.

The purpose of all this is to support prototype-based programming as
well as class-based programming.  Assuming either one or the other
(in the absence of appropriate declaration) is a kind of encapsulation
violation of the .meta interface.

Larry

Reply via email to