Worst ideas/features in programming languages?

Timon Gehr timon.gehr at gmx.ch
Mon Nov 15 15:29:24 UTC 2021


On 15.11.21 15:02, Imperatorn wrote:
> On Monday, 15 November 2021 at 12:41:51 UTC, Timon Gehr wrote:
>> On 15.11.21 10:29, Imperatorn wrote:
>>> On Monday, 15 November 2021 at 00:49:17 UTC, tsbockman wrote:
>>>> [...]
>>>
>>> Well, obviously :)
>>>
>>> It was more of a joke, but it's still pretty cringe to see it
>>
>> The reason it exists is that reverse iteration over unsigned types is 
>> notoriously error prone. I think it's pretty nice to have this built 
>> in, knowing that it will be directly transformed into a simple for 
>> loop even in debug builds. It also allows easily reversing the order 
>> of iteration of any foreach loop, no matter which form. In particular, 
>> there is `static foreach_reverse`.
> 
> What's wrong about retro? Too retro :D

My post was literally a description of drawbacks of retro. There's 
nothing wrong with it in particular, but the main drawback is that in 
general you need to do more than slap retro on the aggregate in order to 
get the correct semantics.

Tuple!(int,int)[] a=...;
foreach(i,x;a){} // reverse this!



More information about the Digitalmars-d mailing list