shortcuts for defining block-local private names, plays nicely with @foo syntax

Allen Wirfs-Brock allen at
Mon Jan 23 11:01:47 PST 2012

Below...Brendan Eich <brendan at> wrote:> Allen Wirfs-Brock <mailto:allen at>
> January 23, 2012 8:43 AM
> On Jan 22, 2012, at 7:36 PM, Tab Atkins Jr. wrote:
> const getIterator = Iterator.getIterator;
> myCoolObject.prototype. at getIterator = function() {...}

Why wouldn't myCoolObject.prototype[iterator.getIterator] work?


It would, for now.  But, I think you gave the reason for avoiding this pattern in another reply. If we ever want to adopt my Reformed Object Model proposal then we should avoid using [ ] for private name property access.  lt would actually still work fine for objects with default [ ] behavior but not for collection objects that redefine [ ] access.

Before encouraging a new pattern like obj[Iterator.GetIterator] we should think about its future-proofing implicationa.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list