in reply to Re: Perl 6 Shocking Revelations II - classes are built, not declared
in thread Perl 6 Shocking Revelations II - classes are built, not declared

Re: I am also not sure that calling it a "class builder" is better then just jumping in a calling them "metaclasses", especially since you start talking about metaobjects in the very next paragraph.

I'm trying to stay away from being locked into a class/metaclass system at all. Metaclasses sounds like Smalltalk, not like Self/Javascript. The meta OBJECT is the HOW, the higher-order-workings, but does not have to represent a "class" per-se. Also, the thing that builds a class (if you have them) by creating the package, internal structures, and creating the meta object does not have to be the same object as that which is installed as the HOW. They could be different interfaces on the same object, but there is no reason they need to be, and some reasons why they don't.

Perhaps I need to separate out layers and not worry about classes and class{} syntax at all when describing the primordial SMD system that does not need to even have classes. Make the jump to the traditional class approach, and the "here is support for making those."

—John

  • Comment on Re^2: Perl 6 Shocking Revelations II - classes are built, not declared

Replies are listed 'Best First'.
Re^3: Perl 6 Shocking Revelations II - classes are built, not declared
by stvn (Monsignor) on May 09, 2008 at 03:32 UTC
    Metaclasses sounds like Smalltalk, not like Self/Javascript.

    Careful, prototype OO is not all it is cracked up to be, it is enjoying a small comeback now that Javascript is being taken seriously. But having been a Javascript programmer for 10+ years now, I can say, its not as cool as people think it is, it's just different. Prototype OO offers you a finer grained re-use mechanism with the prototypical object, but it fails to scale to the needs of larger project organization. Whereas classes have proven themselves in this regard, and Roles with their horizontal re-use have great potential.

    The prototype-ish features of Perl 6, specifically the "class but undef" feature:

    my Dog $fido;
    The value of $fido is undef, but it is typed as a Dog, and can therefore respond to $fido.can('bark'), but cannot respond to $fido.bark(). This can easily be implemented by applying a runtime role to the undef value, that role is parameterized with the class (in this case Dog) and can then respond to the limited number of method calls.

    Also, it is much easier to create a prototype OO system on top of a class based system then it is to do the opposite. Here is an example of Prototype OO layer for Moose, and at one point I had a version of the Perl 6 MetaModel that was in Javascript which would have shown a good example of how tedious is to make classes in prototype land, but you can actually just take a look at all the new JS frameworks there, most of them try to do it.

    -stvn
      I've not used Self, but I understand it is more suitable to "organizing" reuse modules than it is in Javascript.