Generator issue: exceptions while initializing arguments

Kevin Smith khs4473 at
Thu Sep 13 18:23:49 PDT 2012

> We still have the choice of the implicit yield going after argument
> defaulting, not before. SpiderMonkey implements before, though, and my own
> argument from compositionality, above, makes it more clear to me that we
> should go with implicit-yield-first. This makes contrived throwing
> parameter default expressions throw "late" but if that matters, use a
> function combined with a generator.
> In this thread, you and I have agreed on simpler scope/hoisting/defaulting/
> **initialisting a la ES1-5. I think on reflection that this argues for
> the implicit yield in a generator function going before anything with
> observable effects, including argument defaulting.

Sorry to backtrack the thread, but this is going to cause riots.

    function* g(a, b = makeTheWorldABetterPlace()) { ... }

    let iter = g(123);
    // Is the world a better place yet?  I hope so.;

No amount of argument is going to convince a user that defaults should
*not* be executed at the location of the call.  That's just not how it
reads.  No?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list