DMD 0.170 release

Walter Bright newshound at digitalmars.com
Tue Oct 17 11:58:20 PDT 2006


Hasan Aljudy wrote:
> I just go an idea.
> How about adding new statements:
> skip;
> reverse;
> 
> They can be used inside the foreach body to skip over the next iteration

continue;

can be used for that.

> or reverse the order of iteration (dynamically at runtime).

Aaaaggghhhh!!!!

> Also, since foreach already takes two arguments (int i, T t) that is, 
> index and element, you can add a third argument, of bool type, with the 
> meaning "start in reverse mode"
> foreach( true, i, d; "Hello" )
> {
>     writefln( d );
> }
> 
> should print:
> o
> l
> l
> e
> H

That would work, and something like it has been suggested before, but it 
is too obscure looking. When someone sees "foreach_reverse", I think 
it'll be very clear what's going on.



More information about the Digitalmars-d-announce mailing list