About private names

Allen Wirfs-Brock allen at wirfs-brock.com
Sun Mar 20 12:36:19 PDT 2011


On Mar 20, 2011, at 10:55 AM, Andrew Dupont wrote:

> Right; I think Dean and I are saying that this would be the first time obj.foo meant something different from obj['foo']. And to ascertain that those two meant different things, I'd have to go searching through the code for a `private foo` declaration.

With the private name proposal obj.foo and obj.[#.foo] will always mean the same thing regardless of whether foo is scoped as a private name or as a regular property name.  BTW, if you know that a property name is foo, why would you ever code obj["foo"] instead of obj.foo?  [ ]  should only be needed if the property name is not an identifier or is a computed value (hence my original example).

Allen


More information about the es-discuss mailing list