About private names

Allen Wirfs-Brock allen at wirfs-brock.com
Sun Mar 20 10:22:21 PDT 2011

Oops mind fart:

Make that obj.foo===obj[0]

The point is that what follows the dot ia already evaluated differently than what comes between brackets

Dean Landolt <dean at deanlandolt.com> wrote:

>> [snip]
>> >
>> > Anyway, now that I've confirmed my suspicions, I'm hesitant about the
>> private names proposal as described. The fact that declaring a certain name
>> as private affects _all_ property name lookups in that scope (all lookups
>> that use the dot operator or object literal syntax, at least) — well, I'm
>> not sure I like the implications. It would mean a new  and _surprising_
>> distinction between dot notation and bracket notation.
>> There is already a distinction between dot notation and bracket notation:
>>  var obj = {0: "zero", foo: "foo"};
>>  var foo = 0;
>>  print ( obj.foo === obj[foo]);  //false, really obj.foo ===obj[42]
>Wait, what? The correct comparison would be `obj.foo === obj["foo"]`. But
>perhaps something got removed -- where does `obj.foo === obj[42]` even come

More information about the es-discuss mailing list