One way to look at foreach as not so bad

Julio César Carrascal Urquijo jcesar at phreaker.net
Fri Oct 20 19:45:28 PDT 2006


Tom S wrote:
  > Yup, or
> 
> obj.each in (int i) {
>     writefln(i);
> };

Well yes, "in" looks better but it doesn't work right now, "=" does.

> But it will only look like a loop of some sort. Neither continue, break 
> nor return will work in its body.
> The trailing delegate extension would make life easier *hint* *hint* ;)

I see, that would certainly require compiler support, like what the 
compiler is doing for the foreach statement (Returning an int to flag 
break, continue, return) or it will be forcing the user to write the 
return statements all the time.



More information about the Digitalmars-d-announce mailing list