I noticed the absence of setter's, getter's. Would this be valid syntax?
set health(value) {
if (value < 0) {
throw new Error("Health must be non-negative.");
}
@health = value;
}
On Nov 3, 2011, at 12:17 AM, Brendan Eich <[email protected]> wrote:
> What is "super-intuitive" about running 'class C' up against an arbitrary
> expression, which is then evaluated and *copied* (details fuzzy here) as the
> class prototype?
>
> Arguments about feelings and intuition are not that helpful. Saying why you
> need to construct a class that way, where no such object copying primitive
> exists in JS, would be more helpful. IOW, what's the use-case?
>
> /be
>
> On Nov 2, 2011, at 11:03 PM, Matthew J Tretter wrote:
>
>> So to clarify, is the dynamic super issue the whole reason that Jeremy's
>> dynamic construction of classes is considered not doable? Because it seems
>> to me that super may not be worth that trade off. Besides, Python's super
>> implementation requires the hardcoding of the class and that doesn't cause
>> much of a stink. If something similar would give us this super-intuitive
>> syntax and the ability to build classes from arbitrary object literals, it
>> seems like not a big loss.
>
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss