That First Next Argument

Brendan Eich brendan at
Fri Aug 22 17:43:48 PDT 2014

Kevin Smith wrote:
>     Claude suggested (yield?) or some such to get the last value
>     passed via .next to the now running generator. This would not
>     pause execution. It could be used to get that first-next value
>     (this thread's subject) but it could also be used unwisely all
>     over, and it would require the implementation to keep the last
>     value passed to .next in a pigeon-hole per running generator.
>     Hence GC-leak honey trap.
> Thinking this through...  If it's some kind of keyword, then you 
> statically know if and where the current input value is accessed.  If 
> it's not used at all, then you don't need to store the value at all.

Static analysis is an approximation, skirting the halting problem -- 
it'll have coverage gaps.

>  You might also be able to early-release it based on the location of 
> its last appearance before the next yield.  Maybe?

You're over-thinking along one axis only. There's no need for (yield?) 
in full generality. The trick with design is leaving things out, not 
including them on a wing and a prayer. Sorry, gotta call this as I see 
it :-/.


More information about the es-discuss mailing list