Allen Wirfs-Brock (2013-09-06T19:09:08.000Z)
On Sep 6, 2013, at 11:56 AM, Brendan Eich wrote:

>> Allen Wirfs-Brock <mailto:allen at wirfs-brock.com>
>> September 6, 2013 11:48 AM
>> On Sep 6, 2013, at 11:18 AM, Brendan Eich wrote:
>> 
>>>> Allen Wirfs-Brock<mailto:allen at wirfs-brock.com>
>>>> September 6, 2013 11:01 AM
>>>> 
>>>> Almost as good, a arrow function with a generator comprehension as its expression body. For example, a factory for a generator with a lexical this binding:
>>>> 
>>>> c =>  (for (p of c) if (p in this) this[p])
>>>> 
>>>> not much different from a hypothetical generator arrow function and arguably better :
>>>> c *=>  {for (p of c) if (p in this) yield this[p]}
>>> There would be no explicit |yield| in the second example, though. (|yield| is an error in any arrow body.)
>> 
>> why no |yield|?  Note that I wrote a { } body for the generator arrow function body, rather than an expression body and that generator functions use explicit |yield| in their bodies.
> 
> Sorry, brain-fart. You're right.
> 
> On that note, if we had generator arrows, why not allow yield in an expression-body.

That would be ok, but without an expression level looping construct, you can't do anything very interesting with it. So that leads back to using a generator comprehension and the sort of confusing stuff in the second part of my previous reply.

Allen
domenic at domenicdenicola.com (2013-09-18T18:54:28.313Z)
On Sep 6, 2013, at 11:56 AM, Brendan Eich wrote:

> On that note, if we had generator arrows, why not allow yield in an expression-body.

That would be ok, but without an expression level looping construct, you can't do anything very interesting with it. So that leads back to using a generator comprehension and the sort of confusing stuff in the second part of my previous reply.