Immediate closing of iterators

Peter Hall peterjoel at gmail.com
Fri Jan 5 19:07:43 PST 2007


On 1/4/07, Igor Bukanov <igor.bukanov at gmail.com> wrote:
> On 1/4/07, Peter Hall <peterjoel at gmail.com> wrote:
> > But that means a programmer wouldn't have the option to close it
> > manually in that circumstance..
>
> You mean that it would not be possible to use outside for-in loop a
> generator with yield inside try with finally? Surely calling
> generatorInstance.next() will throw an exception in that case but I do
> not see what would prevent calling  generatorInstance.close().
>

Nothing would prevent you calling it. I was rather meaning that, in
cases where the generator cannot be automatically closed, a programmer
should have the option to close it manually, rather than the language
disallowing it and throwing an error.

But this is looking like a non-argument, since a concensus seems to
have been reached already.

Peter



More information about the Es4-discuss mailing list