Hi,

On Thu 07 Aug 2014 11:31, PhistucK <[email protected]> writes:

> Does it mean that you also intend to ship @@iterator methods (unclear
> from your post)?

Yes.

> How much of an effort is implementing the late specification addition? A
> complete implementation is preferred. Can the lack of it be feature
> detected quickly (throwing is not very nice to feature detect)?

It's a bit of work, yes -- it effectively causes each for-of block to be
wrapped in a try-finally.  Since this is the case and it is a late spec
addition it seems best to wait for the ink to dry first.  Firefox also
does not implement this part of the spec.

The lack of this facility can be detected, but not easily:

  function detectCloseOnNonlocalForOfExit() {
    var iter = {
      next: function() { return { value: 10, done: false }; },
      close: function() { throw "foo" }
    }
    iter[Symbol.iterator] = function() { return this; }
    try {
      for (var x of iter) break;
    } catch (e) { return true; }
    return false;   
  }

Incidentally, I'm not sure whether the method is to be called "close" or
"return" -- this is one of those details that I am not sure what the
latest TC39 resolution was, and the final spec language has not been
written yet.  Another reason to punt.

-- 
-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to