On Tuesday, September 16, 2014, Ep Ga <epg...@gmail.com> wrote: > Rick, copy and paste in Firefox--the ones who are most involve in the spec > direction--: > > function r(){ > var i = 0, a = [0,9,8,7,6,5,4,3,2,1]; > return (function (){return a.pop();}); > } > > var rr = r(); > > function y(){ > let i = 0, a = [0,9,8,7,6,5,4,3,2,1]; > while(a){ > yield (a.pop()); > } > } > > Firefox implemented `yield` in normal functions during ES4 prototyping era. It's non-standard, it's wrong and it's not part of ES6. I'm losing patience for this discussion.
> let yy = y(); > > function* g(){ > let i = 0, a = [0,9,8,7,6,5,4,3,2,1]; > while(a){ > yield (a.pop()); > } > } Why would you _ever_ do this? `a` will always evaluate truthy. Writing an intentionally broken program is not a valid argument against anything. > let gg = g(); > > console.log("return: " + rr() + " " + rr() + " " + rr() + " " + rr() + " " > + rr() + " " + rr() + " " + rr() + " " + rr() + " " + rr() + " " + rr() + " > " + rr() + "\n" + > "yield: " + yy.next() + " " + yy.next() + " " + yy.next() + " " + > yy.next() + " " + yy.next() + " " + yy.next() + " " + yy.next() + " " + > yy.next() + " " + yy.next() + " " + yy.next() + " " + yy.next() + "\n" + > "function*: " + JSON.stringify([gg.next(), gg.next(), gg.next(), > gg.next(), gg.next(), gg.next(), gg.next(), gg.next(), gg.next(), > gg.next(), gg.next()])); > > /* > return: 1 2 3 4 5 6 7 8 9 0 undefined > yield: 1 2 3 4 5 6 7 8 9 0 undefined > function*: > [{"value":1,"done":false},{"value":2,"done":false},{"value":3,"done":false},{"value":4,"done":false},{"value":5,"done":false},{"value":6,"done":false},{"value":7,"done":false},{"value":8,"done":false},{"value":9,"done":false},{"value":0,"done":false},{"done":false}] > */ > > Clearly you don't understand the history of iterator and generator design, but read this and please move on: https://github.com/rwaldron/tc39-notes/blob/master/es6/2013-03/mar-12.md (Look for StopIteration) Rick > > -- > Job board: http://jobs.nodejs.org/ > New group rules: > https://gist.github.com/othiym23/9886289#file-moderation-policy-md > Old group rules: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > --- > You received this message because you are subscribed to the Google Groups > "nodejs" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to nodejs+unsubscr...@googlegroups.com <javascript:;>. > To post to this group, send email to nodejs@googlegroups.com > <javascript:;>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/nodejs/cfb22331-3b40-424e-a6d9-a85d765db51c%40googlegroups.com > . > For more options, visit https://groups.google.com/d/optout. > -- Job board: http://jobs.nodejs.org/ New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. To post to this group, send email to nodejs@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/CAHfnhfqsNYJ%3DwA7BmrV4P7278CBkG%2B8zuFxWa-Wy%2BE0jv%3DafKA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.