ARM Blocks: ease of use and for loops

Neal Gafter neal at
Thu Oct 22 00:33:16 PDT 2009

On Thu, Oct 22, 2009 at 12:23 AM, Howard Lovatt <howard.lovatt at>wrote:

> I can think of an example were changing the semantics of a for loop would
> cause problems. If you open a resource, make a first pass over the data
> collecting statistics, then go back and modify the data as a second pass,
> and finally close the resource. I doubt this is common, but the example does
> preclude modifying the for loop to see if a closeable iterator is used. (I
> suspect as Neal has pointed out that in the majority of cases when people
> iterate over the resource and don't immediately close it that they simply
> forgot - but unfortunately there isn't much that can be done about that.)

I can't imagine why such an API would retrofit the Iterator rather than the
Iterable with Closeable.  Besides being wrong, I expect such code is not
just uncommon, but nonexistent.

More information about the coin-dev mailing list