foreach_reverse is better than ever

Jacob Carlborg doob at me.com
Sun Feb 14 02:12:41 PST 2010


On 2/14/10 09:14, Jonathan M Davis wrote:
> Andrei Alexandrescu wrote:
>
>> Gone, that is. Walter agreed to remove it.
>>
>> To achieve the functionality of
>>
>> foreach_reverse (r) { ... }
>>
>> use
>>
>> foreach (retro(r)) { ... }
>>
>> using retro in std.range.
>>
>>
>> Andrei
>
> I assume that this was to get rid of a keyword and reduce duplicate
> functionality.
>
> Though I must say that I find retro to be a bit funny. I would have expected
> it to be reverse. It would be clearer, I think, but it's not like it's hard
> to find out what retro does and remember it.
>
> - Jonathan M Davis

It iterates backwards, all the way back to the 50s. I think "reverse" is 
a much better word.


/Jacob Carlborg



More information about the Digitalmars-d mailing list