Deprecate `!a == b`

Dennis dkorpel at gmail.com
Wed Aug 14 14:36:50 UTC 2024


On Wednesday, 14 August 2024 at 13:26:44 UTC, IchorDev wrote:
> Wow you have some… strange problems.

If you've never made such silly programming mistakes, enjoy it 
while it lasts!

> let’s just add such a mechanism for all of the other situations 
> that might trip up a beginner:

Interesting list. Some of them have been seriously suggested for 
D or implemented in other languages. Specifically, D's integer 
promotion rules get criticized a lot, and some languages are a 
lot stricter about it.

I do agree with you generally: just because a combination of 
features is commonly used mistakenly, doesn't mean a special case 
should be added disallowing the combination.

However, there are cases where the ratio of erroneous usage / 
intentional usage is so large, that a compiler error will in 
practice reduce the total amount of 'programmer rage' so to speak.

Whether `!a == b` is such a case depends. You apparently have 
seen intentional use, so it makes sense you judge it as not worth 
adding an error for. I'm actually curious, can you link to real 
code using that pattern intentionally?

> Other languages will always have things that work in 
> contradictory ways, should we really shape the language around 
> that?

All I'm saying is that it's possible for polyglot programmer's to 
make mixups, in response to you saying you couldn't imagine how 
someone could make a mistake like `!a == b`.



More information about the dip.ideas mailing list