On Wednesday, November 21, 2012 at 3:40 AM, Brendan Eich wrote:
> 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:
>
>
I wish that were true, but I share that from user code I've encountered in the
jQuery bug tracker history. Devs make objects that have a "length" property and
don't understand why their object gets array treatment when passer to library
code (less common these days and arguably a mistake in the duck-typing itself)
or an object with a numeric nodeType property that gets mistaken for a DOM
node.
...Most of this stuff is facepalm inducing :(
> there's no point worrying about the halting problem. Just
> call the quack function and let the chips fall where they may ;-).
>
> /be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss