Worst ideas/features in programming languages?

Timon Gehr timon.gehr at gmx.ch
Mon Nov 15 12:41:51 UTC 2021


On 15.11.21 10:29, Imperatorn wrote:
> On Monday, 15 November 2021 at 00:49:17 UTC, tsbockman wrote:
>> On Sunday, 14 November 2021 at 23:51:00 UTC, Imperatorn wrote:
>>> On Sunday, 14 November 2021 at 21:13:59 UTC, Dr Machine Code wrote:
>>>> On Tuesday, 12 October 2021 at 18:59:29 UTC, Imperatorn wrote:
>>>>> foreach_reverse - worst "feature" mankind has produced
>>>>
>>>> why is it that bad? lol
>>>
>>> It's just so ugly 😅
>>
>> The keyword isn't pretty, but it's useful, easy to understand, and 
>> actually works correctly.
>>
>> I'm sure you can think of something worse if you really try...
> 
> 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`.


More information about the Digitalmars-d mailing list