Tab Atkins Jr. wrote:
On Fri, Mar 15, 2013 at 11:51 AM, Allen Wirfs-Brock
<al...@wirfs-brock.com>  wrote:
On Mar 15, 2013, at 11:22 AM, Axel Rauschmayer 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.
My experience was similar.

Mine's the opposite - my experience with generators in Python built up
a strong and very natural-feeling intuition that a generator was just
a function that returned a "magic list".  Trying to push that into a
constructor notion would feel awkward.

Actually using it would be even more awkward than thinking about it, I
believe.  For example, I use the enumerate() generator *all the time*
in Python.  Having to always write:

     for(x of new enumerate(seq)) {...}

would feel really weird, even if you changed the conjugation of the
function to "enumeration()".

Don't worry, we are not going to require 'new'.

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

Reply via email to