shortcuts for defining block-local private names, plays nicely with @foo syntax
Brendan Eich
brendan at mozilla.org
Mon Jan 23 10:00:50 PST 2012
> 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:
>
>
>> For example, from my post:
>>
>> myCoolObject.prototype[Iterator.getIterator] = function(){...}
>>
>> Using @ for access, would
>> "myCoolObject.prototype. at Iterator.getIterator = function(){...}" work,
>> or would that attempt to retrieve a property using "Iterator" as a
>> Name, then retrieve the "getIterator" property of that?
>>
>> If the latter, this is rather inconvenient for what I expect will be
>> common patterns.
>>
>
> myCoolObject.prototype. at Iterator.getIterator
>
> parses as: ((myCoolObject.prototype). at Iterator).getIterator
>
> which probably is not what you desire.
>
> Taking just what is in my basic proposal, you would have to express
> this using a local variable:
>
> const getIterator = Iterator.getIterator;
> myCoolObject.prototype. at getIterator = function() {...}
Why wouldn't myCoolObject.prototype[iterator.getIterator] work?
/be
More information about the es-discuss
mailing list