On Dec 22, 2010, at 8:50 AM, Kevin Smith wrote: > From my perspective as a JS programmer, overloading the dot seems confusing. > The gains in elegance don't appear to me to be worth it. However, > overloading [] might be more acceptable:
[] gets no respect, I tell ya! ;-) > let x = new PrivateName(); > // or perhaps: > private x; > > function Point() > { > this[x] = 100; > } > > function createPoint() > { > return { > [x]: 100, > }; This is an interesting idea, one I've heard about from Pythonistas who want property names to be evaluated expressions, not implciitly quoted literals if identifier-names, in object initialiser. It would save some amount of eval and Function use. It conflicts with the original MetaProperties syntax at http://wiki.ecmascript.org/doku.php?id=strawman:object_initialiser_extensions (grammar) and http://wiki.ecmascript.org/doku.php?id=strawman:obj_initialiser_meta (examples), which went like so: var fancyObj = { [proto: fancyProto, sealed] prop1: value1, . . . }; but now uses <> instead of []. So no longer a strawman conflict, but I fear the angle brackets are going to cause us some grammatical and nesting-in-HTML pain. /be _______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss