Feedback and comments on ARM proposal - resend

Joshua Bloch jjb at google.com
Thu Mar 19 12:32:19 PDT 2009


Neal.

On Thu, Mar 19, 2009 at 12:17 PM, Neal Gafter <neal at gafter.com> wrote:

>
> Rather, I'm talking about the implicit Iterator variable that is
> created by the expansion of the for-each loop.  Unlike Iterable,
> Iterators are one-shot, so making one a resource is natural.  But,
> with the current ARM proposal, there is no way to use the for-each
> loop with an Iterable whose Iterator is an AutoResource.  Experience
> with C#'s foreach loop and IDisposable/IEnumerable has shown the
> combination to be very useful, as it avoids some very awkward
> situations when both resources and loops are used together in a
> program.
>
> These kinds of issues make me think that more actual experience with
> the proposed construct will be required before we can have confidence
> that it is "right".
>

I disagree.  Java long ago rejected the use of iterators that required
explicit termination.  This is simply a non-issue in the Java ecosystem.
 I'm not saying that it was an entirely good decision, but it is the
decision we made.

             Josh



More information about the coin-dev mailing list