shortcut for private(this)

Tab Atkins Jr. jackalmage at
Fri Jan 20 11:04:25 PST 2012

On Fri, Jan 20, 2012 at 10:59 AM, Erik Arvidsson
<erik.arvidsson at> wrote:
> On Fri, Jan 20, 2012 at 10:46, Herby Vojčík <herby at> wrote:
>> No, I asked for something else. How do it do: "get a private property of
>> <<foo>> whose name is computed by <<expression>>"? Something like
>> foo.@[expr]? Or is there no way to do it?
>> In other words, what is [] syntax for foo. at bar? foo.@["bar"]? foo["@bar"]?
> @bar is a shorthand[*] for this[bar]
> object. at bar is a shorthand[*] for object[bar]
> There is no way to compute a string "bar" to do the lookup since that
> would break private name encapsulation:
> let object = ...
> {
>  let key = Name.create()
>  let secret = {}
>  object. at key = secret
> }
> There must be no way to get access to secret here.
> [*] Using @ does not really invoke []. That is important if private
> names are going to work with the extended collection proposals Allen
> proposed.

Shorter Arv: Private Names are not strings, they're unforgeable
objects.  Thus, it's impossible by design to have an analog of
foo["bar"+baz] for Private Names.  I wrote a blog post about the
subject: <>


More information about the es-discuss mailing list