github at esdiscuss.org (2013-07-12T02:26:54.545Z)
Was there consensus on the return value of the various generator methods being `{ value?, done? }` for `next`/`send`/`throw`? Is it needed for `close`?
The desugaring for yield* in the face of using `{ value?, done? }` is more likely (without refutable matching or `let` expressions for the moment):
```js
let a = yield* EXPR;
```
```js
let a;
{
let g = EXPR;
let received = void 0, send = true, result = void 0;
try {
while (true) {
let { value, done } = send ? g.send(received) : g.throw(received);
if (done) {
result = value;
break;
}
try {
received = yield value;
send = true;
}
catch (e) {
received = e;
send = false;
}
}
}
finally {
try { g.close(); } catch (ignored) { }
}
a = result;
}
```
Was there consensus on the return value of the various generator methods being { value?, done? } for next/send/throw? Is it needed for close? The desugaring for yield* in the face of using { value?, done? } is more likely (without refutable matching or let expressions for the moment): ```js let a = yield* EXPR; ``` ```js let a; { let g = EXPR; let received = void 0, send = true, result = void 0; try { while (true) { let { value, done } = send ? g.send(received) : g.throw(received); if (done) { result = value; break; } try { received = yield value; send = true; } catch (e) { received = e; send = false; } } } finally { try { g.close(); } catch (ignored) { } } a = result; } ``` Ron > -----Original Message----- > From: es-discuss-bounces at mozilla.org [mailto:es-discuss- > bounces at mozilla.org] On Behalf Of Brendan Eich > Sent: Monday, April 29, 2013 9:48 AM > To: Andy Wingo > Cc: es-discuss > Subject: Re: yield* desugaring > > Just a straw-spec device, not proposed for ES6 or 7. > > /be > > Andy Wingo wrote: > > Hi again, > > > > On Mon 29 Apr 2013 17:37, Andy Wingo<wingo at igalia.com> writes: > > > >> let (g = EXPR) { > >> let received = void 0, send = true; > >> while (true) { > >> let next = send ? g.send(received) : g.throw(received); > >> if (next.done) > >> break; > >> try { > >> received = yield next.value; // *** > >> send = true; > >> } catch (e) { > >> received = e; > >> send = false; > >> } > >> } > >> next.value; > >> } > > > > Beyond the scoping error of "next", this desugaring uses let > > expressions, which AFAICS are not in the spec and have not been > > discussed in a few years. Are they actually still a thing? > > > > Andy > > _______________________________________________ > > es-discuss mailing list > > es-discuss at mozilla.org > > https://mail.mozilla.org/listinfo/es-discuss > > > _______________________________________________ > es-discuss mailing list > es-discuss at mozilla.org > https://mail.mozilla.org/listinfo/es-discuss