Top "Language-design" questions

A tag for questions related to the design of any aspect of programming languages.

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

The C# compiler requires that whenever a custom type defines operator ==, it must also define != (see here). Why? I'm curious …

c# language-design
Why does Ruby have TrueClass and FalseClass instead of a single Boolean class?

I was working on serializing values when found out about this one. Ruby has a TrueClass class, and a FalseClass …

ruby language-design
implementing type inference

I see some interesting discussions here about static vs. dynamic typing. I generally prefer static typing, due to compile type …

compiler-construction functional-programming language-design type-inference
Why are there no ||= or &&= operators in C#?

We have equivalent assignment operators for all Logical operators, Shift operators, Additive operators and all Multiplicative operators. Why did the …

c# operators language-design assignment-operator compound-assignment
Why does the postfix increment operator take a dummy parameter?

Have a look at these function signatures: class Number { public: Number& operator++ (); // prefix ++ Number operator++ (int); // postfix ++ }; Prefix doesn't …

c++ operator-overloading language-design prefix postfix-operator
Why doesn't Rust support trait object upcasting?

Given this code: trait Base { fn a(&self); fn b(&self); fn c(&self); fn d(&…

oop rust language-design liskov-substitution-principle
Why does the power operator in F# only work for floating point numbers?

I have never seen a language have exponent or power operator only taking floating point numbers? For example: 2 ** 2 throws an …

f# language-design
Why was the statement (j++); forbidden?

The following code is wrong (see it on ideone): public class Test { public static void Main() { int j = 5; (j++); // if …

c# syntax expression language-design parentheses
What are practical guidelines for evaluating a language's "Turing Completeness"?

I've read "what-is-turing-complete" and the wikipedia page, but I'm less interested in a formal proof than in the practical implications …

computer-science language-design turing-complete
Why is there no base class in C++?

From a design point of view, why is that, in C++, there is no mother-of-all base-class, what's usually object in …

c++ language-design