es-discuss Digest, Vol 46, Issue 22

Dmitry A. Soshnikov dmitry.soshnikov at gmail.com
Thu Dec 23 11:55:45 PST 2010


On 23.12.2010 22:39, Brendan Eich wrote:
> 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?
>
>

I remember the April's discussion of D.Herman's Names, where I assumed 
several syntax "sugars" (?) for that private symbols -- 
https://mail.mozilla.org/pipermail/es-discuss/2010-April/010934.html.

P.S.: It's a really lengthy and epic thread. Hope I'll find the time to 
read it completely. Unfortunately, haven't yet. Will it be a big 
impudence to ask someone (who has a complete understanding and who has 
followed the whole discussion and who has a bit time for it of course) 
to summarize the current state of the discussion (the main points which 
are already discussed and in which all are agree; in which are not 
agree)? Because it's really interesting, but the thread is lengthy and 
still active. I think it will be useful and interesting not only to me, 
since I saw that some JS devs not completely got the essence of the 
current private proposals (because though that it will be like in a 
class-based systems, i.e. not a sugar for a statically-scoped variables 
which can be used as soft-keys of objects).

Thanks,
Dmitry.

>> 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
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss



More information about the es-discuss mailing list