DMD 0.170 release

Bill Baxter wbaxter at gmail.com
Wed Oct 18 14:30:29 PDT 2006


Walter Bright wrote:
> Oskar Linde wrote:
> 
>> Walter Bright wrote:
>>
>>> Bill Baxter wrote:
>>>
>>>> I don't see how it helps.  If you can already do:
>>>>    foreach(T item; &collection.reversed()) { }
>>>
>>>
>>> That doesn't work for arrays.
>>
>>
>> In what way does it not work? I have been doing:
>>
>> foreach(x; "abcd".reverseView())
>>     writef("%s",x);
>>
>> prints "dcba"
> 
> 
> Try that, along with foreach_reverse, and look at the generated code.

Hmm.  So that's the main issue then, is it?  To have a reverse iteration 
on arrays that's as close to a hand-written for-loop as possible?

If you could only think of some way to automatically optimize that case 
to generate the same code...  Is it totally hopeless?

--bb



More information about the Digitalmars-d-announce mailing list