You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently default parameter value initializers are evaluated on the first call to next() on the resulting generator object from a call to a generator function. The ES spec says they should be evaluated on the call to the generator function itself, before it returns the generator object.
E.g.
letx=0;function*gf(a=x=1){}letg=gf();print(x);// should print 1, not 0
One simple solution might be to put a yield between the default parameter initializers and the body in the bytecode and then in the generator function call stub, call next() once, then return the generator object.
The text was updated successfully, but these errors were encountered:
We would call the generator next function directly for this purpose. Indeed we'd only do it this way if we can guarantee no observable effects. I believe this is possible but haven't explored the idea in depth.
Currently default parameter value initializers are evaluated on the first call to
next()
on the resulting generator object from a call to a generator function. The ES spec says they should be evaluated on the call to the generator function itself, before it returns the generator object.E.g.
One simple solution might be to put a yield between the default parameter initializers and the body in the bytecode and then in the generator function call stub, call next() once, then return the generator object.
The text was updated successfully, but these errors were encountered: