es-discuss Digest, Vol 46, Issue 22

Brendan Eich brendan at mozilla.com
Thu Dec 23 11:39:09 PST 2010


On Dec 23, 2010, at 8:36 AM, thaddee yann tyl wrote:

> I understand that the number sign gets really heavy and annoying after
> some time. As a result, I suggest a simpler syntax, "private
> .secret;":
> 
> a = {};
> k = {a: a};
> a['k'] = k;
> function aa(o) {
>  private .a;
>  k..a = o;  // or: private c.a; c.a = o;
>  a.a = a.k.a;  // or: a['a'] = a['k']['a'];
>  a.a = k..a;  // here, on the other hand, k.a is the private stuff.
>  return .a;
> }
> let a2 = aa(a);
> print( a[a2] === a );  // true
> 
> Would this syntax be less Perlish?

The .. is wanted by other extensions, and already used by ECMA-357 (E4X), FWIW.

But perhaps your idea of

  private .x;

is good by itself?


> ps: my understanding is that, using the current specification,
> print(a[a2] === a.k.a) from my earlier email yields true, not false,
> since (a.k.a === a). Am I wrong?

Oh, you're right -- I forgot you set k = {a:a} up front.

/be



More information about the es-discuss mailing list