Herby Vojčík <mailto:[email protected]>
January 22, 2012 12:34 PM
Brendan Eich wrote:
I suspect your very complicated translation with __prvTable__ etc. is
intended to hoist private somehow, once per declaration in source rather
than once per evaluation of declaration. That's too restrictive, since

Exactly. By design.

For classes, we have agreed on class-private, rather than instance-private, instance variables. However you don't need such a complex desugaring for classes, and "private x;" not in a class should be evaluated, not hoisted into singleton-hood somehow.

class Point { ... private x, y; ... } // ignore details of whether in constructor or class body

should desugar roughly to

  let Point = do { private x, y; class Point { ... ... } };

so as to achieve the class-private instance variable semantics wanted. This does suggest that putting the private declarations in constructor is a mistake, since they would seem to be generated once per construction (instance), not once per class (as class-private wants).

/be

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to