instantiating generators

Jason Orendorff jason.orendorff at gmail.com
Fri Mar 15 15:53:29 PDT 2013


On Fri, Mar 15, 2013 at 11:22 AM, Axel Rauschmayer <axel at rauschma.de> wrote:

> I would prefer having to use `new` (but don’t have strong feelings about
> it): generators are more like constructors than like functions. When I
> first started experimenting with them in Firefox, it took me a while to
> figure that out (even though it is obvious in hindsight). With `new`, I’d
> probably have figured it out quicker.
>

I agree with Tab: I wonder if your mental model for generators might not
continue to evolve.

I would hate to have to write:
    for (k of new tree.preorder())
rather than:
    for (k of tree.preorder())

-j
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130315/ec5376b8/attachment.html>


More information about the es-discuss mailing list