Ideas for shortening "foreach_reverse" (was Re: I have a suggestion.)

Jarrett Billingsley kb3ctd2 at yahoo.com
Thu May 17 20:22:19 PDT 2007


"Derek Parnell" <derek at nomail.afraid.org> wrote in message 
news:dabhxjbzr6ww$.1shkxsv5aswsm$.dlg at 40tude.net...
> I also like the styles in which the order qualification is more visually
> linked to the array reference itself. Something along the lines of ...
>
>  foreach( elem, array.order.fwd)
>  foreach( elem, array.order.rev)
>  foreach( elem, array.order.none)
>

I agree.

foreach(elem; array)(reverse)
{
    ...
}

Though that somehow looks a little disconnected.

foreach(elem; array; reverse)
{

}

Hm.

foreach(elem; array, "reverse")
{

}

oops, there's some MiniD.  ;) 





More information about the Digitalmars-d-announce mailing list