Top "Language-design" questions

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

Why does Ruby have both private and protected methods?

Before I read this article, I thought access control in Ruby worked like this: public - can be accessed by …

ruby language-design access-specifier
Why does C++ need the scope resolution operator?

(I know what the scope resolution operator does, and how and when to use it.) Why does C++ have the :: …

c++ operators language-design scope-resolution
When someone writes a new programming language, what do they write it IN?

Please excuse my ignorance. I'm dabbling in PHP and getting my feet wet browsing SO, and feel compelled to ask …

language-design
Why isn't Array a generic type?

Array is declared: public abstract class Array : ICloneable, IList, ICollection, IEnumerable { I'm wondering why isn't it: public partial class Array&…

c# generics types language-design
What are C macros useful for?

I have written a little bit of C, and I can read it well enough to get a general idea …

c macros c-preprocessor language-design language-features
Why doesn't Ruby support i++ or i--​ (increment/decrement operators)?

The pre/post increment/decrement operator (++ and --) are pretty standard programing language syntax (for procedural and object-oriented languages, at …

ruby operators language-design
Is there a better PHP way for getting default value by key from array (dictionary)?

In Python one can do: foo = {} assert foo.get('bar', 'baz') == 'baz' In PHP one can go for a trinary …

php arrays key default-value language-design
Why are const parameters not allowed in C#?

It looks strange especially for C++ developers. In C++ we used to mark a parameter as const in order to …

c# language-agnostic language-design
Why is "final" not allowed in Java 8 interface methods?

One of the most useful features of Java 8 are the new default methods on interfaces. There are essentially two reasons (…

java language-design java-8 default-method jsr335
Why are arrays covariant but generics are invariant?

From Effective Java by Joshua Bloch, Arrays differ from generic type in two important ways. First arrays are covariant. Generics …

java arrays generics language-design covariance