On Sep 10, 2014, at 10:37 AM, Boris Zbarsky wrote: > On 9/10/14, 1:28 PM, Allen Wirfs-Brock wrote: >> Right, or come up with some other way to say: "this loop behaves as if it >> was implemented using for-of". > > Thing is, for my Web IDL use case I don't want _quite_ the behavior of > for-of. I want something like this: > > 1. Let method be the result of CheckIterable(V). > 2. ReturnIfAbrupt(method). > 3. If IsCallable(method) is false, go off and do something else, > since V is not iterable. > 4. Let iter be GetIterator(V, method). > 5. ReturnIfAbrupt(iter). > > and then IteratorStep my way through "iter".
So, try expressing this in JS. That's what a JS help-hosting compliant implementation is going to have to do. > > An additional complication here is that I'm not using this in a situation > where the return value of my algorithm is an ES6 completion (so the > ReturnIfAbrupt bits above there are actually somewhat bunk; they should be > something like "if method is an abrupt completion, then propagate > method.[[value]] as an exception" or some such; we need to figure out how to > make the way DOM/IDL talk about exceptions really interface well with the way > ES does). So I'm not quite sure what IteratorClose should actually do in my > setting, assuming it should be called at all. > IteratorClose, given an abrupt completion and an iterator, calls the iterator's 'return' method if such a method exists. It then proceeds with the abrupt completion (subject to some additional exception juggling in case the 'return' method also throws. ). It all in the IteratorClose spec. Allen _______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss