Worst ideas/features in programming languages?

Stefan Koch uplink.coder at gmail.com
Fri Oct 15 07:18:41 UTC 2021


On Friday, 15 October 2021 at 03:38:56 UTC, Nicholas Wilson wrote:
> they added `if constexpr` not `static if`, which is another 
> thing to add to the list of worst features implemented. The 
> critical difference is that `if constexpr` always adds a scope 
> whereas `static if` doesn't. Adding a scope if you need it 
> costs you {}. This prevents `if constexpr` from being able to 
> conditionally declare declarations (variables, members, members 
> functions etc.)

Actually that avoids many tricky problems in the compiler 
implementation.
When an inline metaprogram can add declarations that requires the 
compiler to have support for deferred and partial symbol 
resolution.

At least if you want it work consistently. Static if, works in 
most cases that I've seen it used... But then again a case that 
didn't work wouldn't end up in production code so it's hard to 
tell. When you start playing around with it a bit you'll find it 
can have very bizarre behavior.


More information about the Digitalmars-d mailing list