Kevin Smith wrote:

    I like your new(){}/static(){} idea at a glance. Need to ruminate
    (moo!) on it at length.

I can't give you a use case (it's just a felling of being a good design thing), but I would like the classes be higher-level construct based on low-level ones. If new()/static() gets in, it defines its own exclusive semantics not possible to do by plain constructor function.

Maybe there should be possibility to define split-body plain constuctor function, too (with semantics identical to class (or vice-versa)).

Bikeshedding:

function new Ctr (a) { constructor body } static (a,b) { static body }

(with static _required_ if new form is used; maybe "static throw" or "static undefined" as shortcuts if one wants static behaviour to throw (system-defined error with "[[Call]] behaviour not supported, this is pure constuctor" meaning) or wants to have it empty; in that case they should be there in class as well).

What does class do if you add new(){} but not static(){}? I presume it [[Call]]s new(){} body...

Some details:

- Clearly super() would have to call the [[Construct]] behavior: new() {}.
- If there were a different number of formal parameters for the two,
what would MyClass.length be?
- What would MyClass.toString() return?

I haven't been able to think of any big problems yet...

kevin

Herby
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to