> I think there are some interesting ideas to explore in both D. Flanagan's
> proposal and D. Herman's variations upon it. However, they both seem to be
> ignoring the second primary use case that I identified: conflict-free
> extensions of build-in or third party objects. While naming conventions or a
> sigil seems to be satisfactory to many as a way to implement "weak
> encapsulation". I don't think it works for the extension case.
I guess the intended spirit of my admittedly not-fully-specified idea last
night was that, other than the required '#' sigil, there's no major difference
from the private names strawman on the wiki. In particular, you could still
reify a private name in an expression context to get a value.
Let's just say, for the sake of concreteness, that the syntax would be:
PrimaryExpression ::= ... | '#' Identifier
So you could do, for example:
function gensym() {
private #x;
return #x;
}
The exact lexical syntax isn't so much the point as just trying to avoid the
ambiguity between public and private identifiers when used after dot or before
colon by using a distinct lexical syntax for private identifiers. This way you
don't have to know what's in scope to know *whether* an identifier is private.
Dave
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss