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:
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.my Dog $fido;
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.
In reply to Re^3: Perl 6 Shocking Revelations II - classes are built, not declared
by stvn
in thread Perl 6 Shocking Revelations II - classes are built, not declared
by John M. Dlugosz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |