d at domenic.me (2015-02-13T23:48:21.800Z)
Oh, I completely agree that `yield *` is not just desugared into the above for...of loop form. I'm just saying that that's how most developers will likely look at it. Adding a while loop that calls the inner iterator's next with the same value wouldn't change what developers would expect here. I'm not arguing for one solution or another - just making the point that if it'll be anything like python's yield from - when developers _think_ of yield* they'll think of pumping an iterator from another iterator and expect the behaviour of throw to be similar.
Oh, I completely agree that `yield *` is not just desugared into the above for...of loop form. I'm just saying that that's how most developers will likely look at it. Adding a while loop that calls the inner iterator's next with the same value wouldn't change what developers would expect here. I'm not arguing for one solution or another - just making the point that if it'll be anything like python's yield from - when developers _think_ of yield* they'll think of pumping an iterator from another iterator and expect the behaviour of throw to be similar. On Sat, Jan 31, 2015 at 9:14 PM, Allen Wirfs-Brock <allen at wirfs-brock.com> wrote: > > On Jan 31, 2015, at 10:13 AM, Benjamin (Inglor) Gruenbaum wrote: > > > I think that people would generally will _expect_ `yield *` to be have > like yield inside a loop. So most people would expect: > > > > ``` > > yield* iterator > > ``` > > > > To behave like: > > > > ``` > > for(let val of iterator){ > > yield val; > > } > > > > ``` > > > > While I'm not (yet) suggesting that the behaviour should be similar in > both cases this is definitely something to consider before deciding on > throwing or suppressing. > > They are similar, but the transparency requirement of yield* has priority > It's not a pure desugaring. For example, yield* passes throw the > IteratorResu;lt objects produced by the inner iterator. The above > desugaring can't do that. > > Allen > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150131/2fa3bd2e/attachment.html>