"Subclassing" basic types in DOM - best method?

Brendan Eich brendan at mozilla.com
Wed Nov 21 00:40:09 PST 2012

Tab Atkins Jr. wrote:
>> let o = { items: function() {} };
>> >
>> >  would pass that test.
> I'm not sure how else you're supposed to detect iterables.

It's not 'items', btw. The iterator-getter/maker is named 'iterator' in 
SpiderMonkey currently, and last I heard would be @iterator (well-known 
public symbol) in ES6.

As with most duck typing, you're right and I think Rick is picking on a 
non-issue: there's no point worrying about the halting problem. Just 
call the quack function and let the chips fall where they may ;-).


More information about the es-discuss mailing list