instantiating generators

Andy Wingo wingo at igalia.com
Tue Mar 12 10:04:00 PDT 2013


Hi,

Given "function* g() { yield 1; }", are these equivalent?

  new g();
  g();

Somehow I had assumed that /calling/ would be the normal way to
instantiate a generator, but I see "new" in
http://wiki.ecmascript.org/doku.php?id=meetings:proposed_generator_class_hierarcy_nov_2013.png.

Thanks,

Andy
-- 
http://wingolog.org/


More information about the es-discuss mailing list