Should be doable in builtin JS
Dupe of 130966, landed in http://trac.webkit.org/changeset/167797.
*** This bug has been marked as a duplicate of bug 130966 ***
Wrong bug, sorry!
This bug should be simple, but is at least partially blocked on iterators being available.
We support for-of on all currently iterable types, as well as the spread operator so should be either
I can't recall spec of the top of my head
You're correct, for-of and the spread operator are supported for certain types (although strings appear to not be iterable yet in JSC).
However, iterator methods seem to be attached via private properties / internal slots, rather than using the well-known symbol @@iterator.
The Array.from algorithm uses `GetMethod(items, @@iterator)` to determine whether or not it can use the from-iterable path or the from-array-like path, so an implementation is still sort of blocked on that (or at least blocked on exposing a getter for the private iterator properties to JS builtins, if it is to be implemented in JS).
I would actually say that the hardest part here will be updating the builtins generation logic to support constructor/static functions.
The subsequent logic would be to expose (as a private global) the Symbol object, with @@iterator attached. (You'd still need to use for-of. Our internal iterator implementation doesn't match spec behaviour for reasons best summed up as "performance")
note builtin JS can do magical things - look at the js files in builtins/
This is done.