I have a suggestion.

antonio antonio at abrevia.net
Wed May 16 11:05:04 PDT 2007


Pragma wrote:
> freeagle wrote:
>> YonggangLuo wrote:
>>> i think it's will be a good idea to replace "foreach_reverse" with  
>>> "frr".
>>> "foreach_reverse" is too long as a keyword
>>
>> I find "frr" very cryptic.
>>
>> consider this:
>>
>> if(reverse)
>> {
>>     frr(int i, array)
>>     {
>>         ...
>>     }
>> }
>> else
>> {
>>     foreach(int i, array)
>>     {
>>         ...
>>     }
>> }
>>
>> Those keywords doesn't seem related, but would in fact provide similar 
>> funcitonality.
>>
>> I too would like to see this "foreach_reverse" solved in other way, 
>> but not with another keyword
>>
>> freeagle
> 
> I agree with you completely.  While I understand the goal behind 
> "foreach_reverse" is to put optimal array-traversal-loop generation in 
> the hands of the compiler (read: faster than opApply), the keyword 
> itself remains the only real wart.  The keyword "rforeach" would have 
> made a much better candidate IMO.
> 
I think the more "algebraic" way could be something like

foreach(int i; reversed array)

compiler must act in the optimal way.






More information about the Digitalmars-d-announce mailing list