Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • by tyan (5925) on 2005.05.15 18:16 (#40427)
    I am not so sure about meta-meta-classes, or at least not that name.

    Suppose you have a class Book. You refer to the class as Book, and instances of the class as Books. The same name is used interchangeably without confusion. I think that the same should apply to 'meta-class'. Just as Books are instances of the Book class, I think meta-classes are instances of the meta-class class.

    AFAIK The C<Class> class is the meta-class class in perl 6, and meta-classes are instances of C<Class> (what you get when you call the C<meta> method). Maybe it is just me, but I find this far less confusing than introducing the term meta-meta-class.

    Given the above, a common question might be: why do we not need meta-meta-classes (a class to describe the C<Class> class)? The answer is that we already have the C<Class> class to describe the C<Class> class. For example:

    my $camel_book = Book.new;
    my $book_class = $camel_book.meta; # $book_class isa Class
    my $class_class = $book_class.meta; # $class_class isa Class

    Tom
    • Hmm, my understanding is that meta-meta-class does not exist in the language per se; it is a concrete implementation of the metaclass in the compiler or interpreter itself. The user would have no way to directly access or manipulate meta-meta-classes -- it is essentially an "out of system" thing of interest only to language implementors.
    • Tom,

      As Autrijus pointed out, the meta-meta-class is not accesible in the "user space", but a language implementation level object. And the reason we are calling it the meta-meta-class is that it actually is not MetaClass itself, but a MetaClass is an instance of the MetaMetaClass. (it's confusing I know)

      To expand on your example: the class Book {} can be called "Book". When you call the meta method on Book, you will get an instance of the Class metaclass for Book, not the Class class.

      At some point

      --
      -stvn
      • Hi

        Thanks for your detailed response and amazing work getting oo going in pugs. Still twisting my brain into the right shape to fit this stuff in :-)

        As you say, calling C<meta> on the C<Book> class yields an instance of the C<Class> metaclass that describes the C<Book> class. My example takes this one step further by calling the C<meta> method on this metaclass and (by my assumption) getting an instance of the C<Class> metaclass that describes the C<Class> class. T
        • Tom

          Let me first say that we are venturing into unspecced territory here. So anything I say is subject to the whim of @larry.

          What said you is correct, with one minor adjustment. You said:

          My example takes this one step further by calling the meta method on this metaclass and (by my assumption) getting an instance of the Class metaclass that describes the Class class. This is based on my assumption that there is a cycle at the Class level

          But you missed a few metas :)

          My example takes this one ste

          --
          -stvn