I see, so private declarations may go back to being defined at the class level 
- at least semantically - in order for the private name to be in scope 
across the class eg this[heath] referenced in Monster prototype methods: get 
isAlive(), Monster.set health(). 


________________________________
From: Brendan Eich <[email protected]>
To: Kam Kasravi <[email protected]>
Cc: Mark S. Miller <[email protected]>; Axel Rauschmayer <[email protected]>; 
es-discuss <[email protected]>
Sent: Sunday, September 25, 2011 8:10 PM
Subject: Re: Class literals: does "public" still make sense?


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

Reply via email to