Gavin Barraclough <mailto:barraclo...@apple.com>
January 23, 2012 12:54 PM
On Jan 23, 2012, at 12:27 PM, Brendan Eich wrote:

Is the intention here that the private name object would be in scope, and accessible to the user? – if so, this does seem useful, but using the plain name of the property seems potentially prone to typos, e.g.

let o = {};
{
private x:
o.setX = function(x) {
@x = x;
}
o.getX = function() {
return x; // should be 'return @x;'
}
}

I seems that this would be an easy mistake to make, and doesn't appear to be a syntax error is x is in scope.

Yes, so the above would need to use px or some such obfuscated name for the private binding.

Previously we had private x; bind in a separate lexical chain from the one searched for identifiers to right of . and before : in object literals. That foundered on readability (which x?).

Then I think we considered a proposal where private x; bound in a separate lexical chain but that chain was searched *only* on right of @. That proposal seemed not to have the readability drawback. It also solves the problem you show above?

But now we've jumped to same single lexical chain. Did we skip a useful alternative design?

/be


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

Reply via email to