Feedback and comments on ARM proposal (original) (raw)

Neal Gafter neal at gafter.com
Mon Mar 9 18:52:18 PDT 2009


The for-each construct generated less controversy or concern than the ARM construct, as the desired semantics and the desugaring are much more straightforward. Most of the discussion revolved around extending it in various ways. The trickiest part was getting the interfaces just right to allow maximal interoperability.

Regarding Iterator, the Iterable/Iterator ambiguity was a concern but a minor point: we could have simply defined it as a compile-time error to use such a type in a for-each loop. We were more concerned with allowing the programmer access to the variable that's directly manipulated by compiler-generated code, possibly undermining the generated code's assumptions about the state of the Iterator.

On Mon, Mar 9, 2009 at 4:37 PM, Roel Spilker <r.spilker at gmail.com> wrote:

A bit off-topic, and just out of curiosity: What is the reason the for-each cannot work on Iterators? Is it just the problem when both Iterable and Iterator are implemented, or were there other reasons as well?

Roel

At this point, I think only one name will be supported (close), so the problem goes away.  We went through the same conniptions with the for-each statement (Does it work on Iterator as well as Iterable?  What happens if you implement both?).



More information about the coin-dev mailing list