>> class literals look the same but literal declaration are a right pain for
>> any kind of meta programming. I can't take an existing object and turn it
>> into a "class" without using eval.
>
> Can you elaborate?
>
> Let's say I have object/class A and object/class B, I want a new class that
> is the union of A and B. (basically a mixin).
>
> There is no way of saying C = union(A,B) without using your standard
> functions and function.prototype.
>
> Where as with prototypes as classes it would be as simple as saying var C =
> Object.extend({}, A, B) (for some value of Object.extend)
>
> There are other examples of meta programming you cannot do with class
> declaration (without using eval. You can do anything with eval)
It will be more work, but the prototypes are still there and can be combined as
you describe above. I don’t think you need eval().
> Not to mention that es:h classes desugar to functions as classes rather then
> prototypes as classes (the latter doesn't exist yet).
The under-the-hood manipulations will be a bit more complicated, but the end
result will always have the clear separation of responsibilities between
constructor and prototype.
> I'd just think implementing prototypes as classes has very little to loose as
> long as we dont go and fix all the existing objects (Object.prototype,
> Function.prototype, String.prototype, etc)
I guess that is the rub, reworking the standard types and all the code that
uses Class.prototype.* instead of Class.*. It would have to be done to make
things clean again and it would be too much work.
--
Dr. Axel Rauschmayer
[email protected]
twitter.com/rauschma
home: rauschma.de
blog: 2ality.com
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss