Andy Wingo (2013-07-23T08:33:57.000Z)
domenic at domenicdenicola.com (2013-07-23T16:51:28.670Z)
On Wed 17 Jul 2013 10:50, "Claus Reinke" <claus.reinke at talk21.com> writes: > And why not? Because `yield` is a statement `yield` is an expression. > Why shouldn't I be able to traverse an array, using the ES5 standard > operations for doing so, yielding intermediate results from the > traversal (recall also that yield can return data sent in via .next, > for incorporation into such traversals)? You certainly can, with one modification: using *ES6* standard operations (external iterators vs the ES5 forEach internal iterator). Generators and non-generator iterators and for-of and comprehensions hang together really nicely in practice. > Methods can be replaced by built-ins. It is the reverse that > is now broken. Au contraire, but it requires a re-think on your part: favor external iterators over internal iterators.