PROPOSAL: Enhanced for each loop iteration control

Stephen Colebourne scolebourne at joda.org
Mon Mar 30 16:51:43 PDT 2009


Marek Kozieł wrote:
> So from your proposal I would remove Interface-s and link iterator
> through label,
> label type is return type of .iterator() method.

> String[] array ...;
> i: for (String s:array){
>     i.getIndex;//?
> }

While I understand that this may seem appealing, it really isn't. Labels 
are in a different namespace IIRC, and using that for psuedo method 
calls is really an abuse.

I accept that my proposal doesn't allow custom iterators, but I don't 
believe that to be a major problem. Consider it that my proposal tackles 
80%+ of the problem (which was part of the 20% of the original looping 
problem, and still a good number of LOC in a reasonable system).

Stephen




More information about the coin-dev mailing list