instantiating generators

Brendan Eich brendan at
Tue Mar 12 10:42:56 PDT 2013

This is not what we prototyped and shipped in SpiderMonkey starting in 
2006, and Rhino and probably other engines cloned, for years. That's not 
to say we should or shouldn't do it, but I'm always leery of made-up 
stuff without any prototype-implementation mileage.

Allen, is there any reason to make things more nested, with hidden 
(Generator) constructor? I see what you're getting at but the lack of it 
has never been an issue for JS1.7+ users. When in doubt, flat is better 
than nested (Zen of Python).


Andy Wingo wrote:
> 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
> Thanks,
> Andy

More information about the es-discuss mailing list