`of` operator ES7 proposal from Ian Bicking
brendan at mozilla.org
Mon Mar 30 19:02:30 UTC 2015
Michał Wadas wrote:
> First possible problem - "of" used in if statement can put iterator in
> unexpected state or result in arbitrary side effects.
First, you shouldn't assume this would be based on the Symbol.iterator
protocol. I wrote something like @@hasInstance for instanceof was the
precedent to follow.
Second, the iteration protocol would require exhaustively searching for
values. Side effects of iteration are the least worry!
Finally, even if the iteration protocol were used, there would be no
shared/reused iterator. You get a fresh one from well-implemented iterables.
More information about the es-discuss