On Sep 25, 2011, at 3:12 PM, Kam Kasravi wrote:
> class Monster {
> // The contextual keyword "constructor" followed by an argument
> // list and a body defines the body of the class’s constructor
> // function. public and private declarations in the constructor
> // declare and initialize per-instance properties. Assignments
> // such as "this.foo = bar;" also set public properties.
> constructor(name, healthvalue) {
> public name = name;
> module name from "@name";
> private health = name.create();
No, that's silly. If there is to be private declaration syntax, it should
generate the private name, class-private (shared among instances). What you
just spelled out wants 'const' not 'private', but hoisted to an outer closure.
The way you wrote it, each constructor call would make a new and unique private
name, so you'd get instance-private instance variables, not class-private.
> this[health] = healthvalue;
This part is what we agreed to in July.
/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss