That First Next Argument

Andy Wingo wingo at
Thu Aug 21 00:04:22 PDT 2014

On Wed 20 Aug 2014 19:55, Brendan Eich <brendan at> writes:

> Kevin Smith wrote:
>>     function *echo() input {
>>         while (true) yield input.value;
>>     }
> So input is bound to the next() actual parameter value on each
> resumption. That's not bad shed-coloring!
> Andy, Dave: WDYT?

I think changing things right now is the wrong thing to do.  Since this
is a compatible extension, we don't have to think about this for ES6.
Just putting that out there ;)

That said, first thoughts:

  * I assume "input" could then be captured by nested scopes.  This
    would be a bit strange but could work.

  * Really you'd want to be able to destructure too, as you can in every
    other part of the grammar that introduces names.  That's probably
    not a great thing to do here, though.

  * I assume Kevin meant:

      function *echo input { while (true) yield input }

To me it smells, but perhaps that is just my grumpiness ;)

Explicitly being able to place the initial yield would be nicer, but
then it's more difficult to ensure that the initial yield comes before
other yields.

I say punt ;)


More information about the es-discuss mailing list