April 10 2014 Meeting Notes
Allen Wirfs-Brock
allen at wirfs-brock.com
Thu Apr 24 10:57:43 PDT 2014
On Apr 24, 2014, at 10:24 AM, Brendan Eich wrote:
> Allen Wirfs-Brock wrote:
>> If (and it's still an open question) it make sense semantically to call "return" on for-of initiated generators on unwind, then that is what we should do.
>
> That's not the proposal, though, is it?
>
> Isn't the maybe-call of return for any iterator, whether a generator iterator or other object, and isn't it unconditional on whether the for-of implicitly created a fresh iterator via @@iterator?
Right, any iterator with a @@return (or whatever). But at the meeting (Thursday) we also discussed that for-of would act on the assumption that the normal case was getting a fresh iterator that was intended to be finalized (ether via exhaustion or implicit @@return calls on early loop exits). In the rarer case where somebody needs multiple loops over a single iterator they would avoid for-or and use while or for(;;) loops.
But I don't think the difference between my shorter description and the actual proposal is germane to the arguments that catching loop early unwind exits is/isn't too expensive.
Allen
More information about the es-discuss
mailing list