Igor Bukanov wrote:
> 2009/5/18 Brendan Eich <bren...@mozilla.com>:
>> On May 18, 2009, at 2:25 AM, Igor Bukanov wrote:
>>> The plus side of this is that an empty generator can be created with a
>>> straightforward:
>>>
>>>  Generator(function() {})
>>>
>>> and not with a rather unnatural
>>>
>>>  (function() { if (false) yield; })()
>> No one makes empty generators.
> 
> For me the problem with the way the generators are defined is that a
> dead code like that "if (0) yield;" affects the semantic by mere
> presence of it. Surely, this is not the first feature in ES that has
> that property - "if (0) var a;" is another example. But "if (0)
> yield;" sets a new record affecting the nature of the whole function.

A more explicit alternative is to require some kind of decoration on the
function definition, e.g. (just a straw man):

  function generator foo() { ... }

-- 
David-Sarah Hopwood ⚥

_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to