shortcut for private(this)
herby at mailbox.sk
Fri Jan 20 10:39:41 PST 2012
Brendan Eich wrote:
> And again, we do not want a reified "private state object", so private
> could not be a free expression. This also hurts private(other).weight --
> 'weight' is not an identifier in a "private state object", it has to be
> a private name object binding. Therefore we should avoid any syntax
> suggesting a first-class reflection of a private state object.
How do I do private(foo)[expression]? Or I don't (yes, it can be worked
around by foo. at store[expression], but)?
> This is why @foo for private name object bound to lexical identifier foo
> has been proposed. It also has the benefits of being shorter and
> matching some other languages near to JS.
I did not know. I have read the class proposal (I need to rework
Empowered Data not to use @).
I am all for @bar (or something), I like the concise syntax for "private
property name" concept. In fact I wanted it, and wanted to propose
something lot crazier (private keyword itself being modifier of the
property name, so foo.private bar, foo[private expr]; but @ is better
(except I don't know if it is -friendly).
More information about the es-discuss