About private names

Andrew Dupont mozilla at andrewdupont.net
Sun Mar 20 21:58:07 PDT 2011


On Mar 20, 2011, at 11:05 PM, David Herman wrote:

>> right now, bracket notation is a superset of dot notation, but it would no longer be under the proposed syntax.
> 
> I'm afraid I can't figure out what this means, but it doesn't sound true to me.

I noticed (in both this thread and the December thread) a back-and-forth where one person said that `obj.foo` and `obj['foo']` were equivalent, and a second person replied to say, no, they're not exactly equivalent. I was trying to bypass that quibble.

Right now, everything that can be expressed via dot notation has an analog in bracket notation that means the same thing. Bracket notation can additionally accommodate any string that doesn't qualify as an IdentifierName. That's what I meant by "superset."

> Hm, it didn't really sound like complexity that you were objecting to, so much as the danger of confusion caused by having the dot-notation be overloaded.

Either phrasing is accurate.

> Does my point about dot-notation make sense to you? What do you think of the above revision of the proposal?

The revision would address all my concerns — thanks. I'm all for distinguishing the static case from the dynamic case, as long as we can maintain the separation between public names and private names, and know which is which without indirection.

Cheers,
Andrew


More information about the es-discuss mailing list