Immediate closing of iterators

Igor Bukanov igor.bukanov at gmail.com
Thu Jan 4 01:21:24 PST 2007


On 1/3/07, Brendan Eich <brendan at mozilla.org> wrote:
> On Jan 2, 2007, at 3:23 PM, Chris Hansen wrote:
> for JS1.7
> (in Firefox 2), we followed Python 2.5 closely for the sake of
> guaranteeing finally execution when the last yield is from the
> matching try.

A simple way to address it is to require at the runtime that when
yield is executed inside try with finally, the iterator object must be
a part of for-in loop or, potentially, C#-like  autoclose(obj) {}
block. If this is not the case, an exception should be thrown.



More information about the Es4-discuss mailing list