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

Allen Wirfs-Brock allen at wirfs-brock.com
Mon Jan 23 11:01:47 PST 2012


Below...Brendan Eich <brendan at mozilla.org> wrote:> Allen Wirfs-Brock <mailto:allen at wirfs-brock.com>
> 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?

/be

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.

Allen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120123/03acde02/attachment-0001.html>


More information about the es-discuss mailing list