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
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to