Allen Wirfs-Brock (2014-09-10T20:11:51.000Z)
domenic at domenicdenicola.com (2014-09-17T22:03:50.801Z)
On Sep 10, 2014, at 12:41 PM, Boris Zbarsky wrote: > I feel like I'm missing something here. > > "iter" is an iterator, not an iterable. So I don't think this will do the right thing, unless I'm seriously missing something. In practice (because of for-of semantics) Iterators need to be Iterables that return themselves as the associated iterator. All built-in iterators in ES have this characteristic > What I am trying to define in Web IDL is the semantics of methods that take an argument which is either an iterable or something else. That means they need to check whether the given thing is iterable, and if so iterate, otherwise do something else. See the thread that ended up in http://lists.w3.org/Archives/Public/public-script-coord/2013OctDec/0370.html and the algorithm in that mail; that's what I'm specifying. For example, Array.from does that kind of argument discrimination: http://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.from > It only does when the iterator claims there are no more things to be had, in which case do I still want to be calling the return() thing? No, you only call 'return' when exiting the loop before the iterator has indicated that it is 'done'..