Why must we define both == and != in C#?

I can’t speak for the language designers, but from what I can reason on, it seems like it was intentional, proper design decision. Looking at this basic F# code, you can compile this into a working library. This is legal code for F#, and only overloads the equality operator, not the inequality: module Module1 type … Read more

Why C# won’t allow field initializer with non-static fields?

I’m more interested with the reason/logic for why it was restricted. just for curiosity. If you read the C# Language Spec, 10.11.3, it hints as to the rationale here. In discussing variable initializers: It is useful to think of instance variable initializers and constructor initializers as statements that are automatically inserted before the constructor-body. Since … Read more

How does a stackless language work?

The modern operating systems we have (Windows, Linux) operate with what I call the “big stack model”. And that model is wrong, sometimes, and motivates the need for “stackless” languages. The “big stack model” assumes that a compiled program will allocate “stack frames” for function calls in a contiguous region of memory, using machine instructions … Read more

Why is “final” not allowed in Java 8 interface methods?

This question is, to some degree, related to What is the reason why “synchronized” is not allowed in Java 8 interface methods? The key thing to understand about default methods is that the primary design goal is interface evolution, not “turn interfaces into (mediocre) traits”. While there’s some overlap between the two, and we tried … Read more