That First Next Argument

Brendan Eich brendan at mozilla.org
Thu Aug 21 09:58:36 PDT 2014


Kevin Smith wrote:
>
>
>     I've been thinking about ways to explicitly place the initial
>     yield.  One ideal is a reserved keyword sequence starting with
>     'yield`, such as `yield continue` to mark the initial yield point.
>     If a generator function does not contain an explicit `yield
>     continue`, then it is implicit at the start of the function body.
>
>
> So when the generator function is executed (and before next has been 
> called), it will run until the `yield continue` (or somesuch), instead 
> of stopping at the start of the function body?
>
> That would be great, actually.

Except it's an oxymoron: the continue does not mean 
no-pause-at-this-yield, and the proposal abuses the keyword otherwise 
used only with loops.

Also, write your echo generator this way. You have to duplicate code.

/be




More information about the es-discuss mailing list