2 ms·
> unforced error and a pointless footgun I think it’s the other way. Providing one based on the other is a pointless footgun. The experience doesn’t end when
by Const-me 7y ago
> unforced error and a pointless footgun
I think it’s the other way. Providing one based on the other is a pointless footgun.
The experience doesn’t end when you’ve made machine code from your source. Developers debug stuff. Developers support their products, sometimes analyzing crash dumps.
The more magic is used in the compiler, the harder it is to debug and support software.
Sometimes that’s justified, e.g. in C# there’s substantial amount of compiler magic for generators and async functions. But these 2 features save substantial amount of code complexity.
Implementing != from == and > from < only provides minimal profit. The manual implementation is a single line method.
Another reason, C# is different language than Rust or Python. It has awesome support for OOP and runtime reflection. What should happen if you use reflection to get op_Inequality for a class where only == is defined? What should happen if you define == in a base class and != in a derived one?