Axel Rauschmayer (2013-11-16T09:36:41.000Z)
Caveat: with yield*, you want generators to be more like functions than like blocks.


[[[Sent from a mobile device. Please forgive brevity and typos.]]]

Dr. Axel Rauschmayer
axel at rauschma.de
Home: http://rauschma.de
Blog: http://2ality.com

On 16.11.2013, at 10:28, "Claus Reinke" <claus.reinke at talk21.com> wrote:

>>> What I don't understand is why generator expressions are not used
>>> as the only way to create generators, leaving 'function' alone.
>> We have been over this before: to support flows that for-of loops cannot expression, specifically coroutine libraries such as http://taskjs.org/.
> 
> Which is why I keep suggesting block-style generator expressions
> in addition to comprehension-style generator expressions. The
> equivalent of today's
> 
>   function*() { ... yield value ... }
> 
> would be 
>   function() { return do* { ... yield value ... }}
> 
> or, if 'function' peculiarities don't matter, the simpler
> 
>  () => do* { ... yield value ... }
> 
> As far as I can tell, no functionality would go missing. 'function' and arrow would remain on par and function and generators would
> remain separate (but composable) building blocks, leading to a more
> modular language spec. You could keep 'function*' as syntactic sugar.
> 
> Claus
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
domenic at domenicdenicola.com (2013-11-22T17:57:15.732Z)
Caveat: with yield*, you want generators to be more like functions than like blocks.