An "extend" operator is a natural companion to <|
brendan at mozilla.com
Tue Jul 19 11:23:52 PDT 2011
On Jul 19, 2011, at 11:07 AM, Bob Nystrom wrote:
> // "new" lets you declare members on new instances. these would presumably be
> // invoked on the new object before the constructor body is run.
> numAttacks = 0;
> // declaring an instance property here mainly so you can document it. could be
> // useful later for guards or other annotations.
The plain name; also looks like a useless expression-statement.
Beyond this, I'm concerned that per-instance properties need initializers that use constructor parameters. So they ought to be initialized in the constructor.
Whether they can be declared outside the constructor is a separate issue. Perhaps if they have constant or constructor-invariant initializers, they can be initialized where declared too.
But declarations should look different from expressions. The alternative we keep returning to is the property assignment sub-grammar of object literals, which would want
with a semicolon not a comma.
Anyway, this is a detail, and we could even defer it and still have a better class proposal using your C++-inspired label idea. I'm quite taken with that!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss