Top "Language-design" questions

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

Why do we need break after case statements?

Why doesn't the compiler automatically put break statements after each code block in the switch? Is it for historical reasons? …

java switch-statement case language-design break
Why does C++ not allow inherited friendship?

Why is friendship not at least optionally inheritable in C++? I understand transitivity and reflexivity being forbidden for obvious reasons (…

c++ inheritance language-design friend
Conventions for exceptions or error codes

Yesterday I was having a heated debate with a coworker on what would be the preferred error reporting method. Mainly …

language-agnostic language-design
Why can't your switch statement data type be long, Java?

Here's an excerpt from Sun's Java tutorials: A switch works with the byte, short, char, and int primitive data types. …

java switch-statement long-integer language-design
Why doesn't a python dict.update() return the object?

I 'm trying to do : award_dict = { "url" : "http://facebook.com", "imageurl" : "http://farm4.static.flickr.com/3431/3939267074_feb9eb19b1_…

python dictionary language-design language-features
Why doesn't String switch statement support a null case?

I am just wondering why the Java 7 switch statement does not support a null case and instead throws NullPointerException? See …

java switch-statement language-design
Why does C++ need a separate header file?

I've never really understood why C++ needs a separate header file with the same functions as in the .cpp file. …

c++ language-design
Why can't we define a variable inside an if statement?

Maybe this question has been answered before, but the word if occurs so often it's hard to find it. The …

c# language-design scope
Why is an array not assignable to Iterable?

with Java5 we can write: Foo[] foos = ... for (Foo foo : foos) or just using an Iterable in the for loop. …

java language-design
Why are there no sorted containers in Python's standard libraries?

Is there a Python design decision (PEP) that precludes a sorted container from being added to Python? (OrderedDict is not …

python language-design sortedset sortedmap