254 votes
Accepted

Syntax Design - Why use parentheses when no arguments are passed?

For languages that use first-class functions, its quite common that the syntax of referring to a function is: a = object.functionName while the act of calling that function is: b = object....
Nathan Merrill's user avatar
245 votes
Accepted

Why is XML called a "language" exactly?

The real answer is XML has an L in the name because a guy named Raymond Lorie was among the designers of the first "markup language" at IBM in the 1970'ies. The developers had to find a name for the ...
JacquesB's user avatar
  • 58.7k
180 votes

Why is XML called a "language" exactly?

Because it is a language. A markup language, not a programming language. Notice that natural human languages like English and Spanish don't "do" anything either. In fact, technically C++ and Java and ...
Ixrec's user avatar
  • 27.7k
124 votes
Accepted

Why F#, Rust and others use Option type instead of nullable types like C# 8 or TypeScript?

The purpose of Null Tracking in general (of which Nullable Types are only one of many different forms), is to somehow regain a modicum of safety (and sanity) in languages that have null references. If ...
Jörg W Mittag's user avatar
104 votes
Accepted

Is it a bad design for a programming language to allow spaces in identifiers?

Consider the following. var [Example Number] = 5; [Example Number] = [Example Number] + 5; print([Example Number]); int[] [Examples Array] = new int[25]; [Examples Array][[Example Number]] = [...
T. Sar's user avatar
  • 2,110
103 votes

Why is XML called a "language" exactly?

Let Σ be a non-empty, finite set of symbols, called an alphabet. Then Σ* is the countable infinite set of finite words that can be formed by concatenating zero or more symbols from Σ....
5gon12eder's user avatar
  • 6,986
88 votes
Accepted

Why does the type go after the variable name in modern programming languages?

All of the languages you mentioned support type inference, which means the type is an optional part of the declaration in those languages because they're smart enough to fill it in themselves when you ...
Ixrec's user avatar
  • 27.7k
87 votes

Why is Arithmetic Overflow ignored?

There are 3 reasons for this: The cost of checking for overflows (for every single arithmetic operation) at run-time is excessive. The complexity of proving that an overflow check can be omitted at ...
Brendan's user avatar
  • 3,925
66 votes
Accepted

Should "Set" have a Get method?

The problem here isn't that HashSet lacks a Get method, it's that your code makes no sense from the perspective of the HashSet type. That Get method is effectively, "get me this value , please", to ...
David Arno's user avatar
  • 39.2k
65 votes

Syntax Design - Why use parentheses when no arguments are passed?

Indeed, Scala allows this, though there is a convention that is followed: if the method has side-effects, parentheses should be used anyway. As a compiler writer, I would find the guaranteed presence ...
Robert Harvey's user avatar
65 votes

Why is Arithmetic Overflow ignored?

Who says it's a bad tradeoff?! I run all of my production apps with overflow checking enabled. This is a C# compiler option. I actually benchmarked this and I was not able to determine the difference....
usr's user avatar
  • 2,764
63 votes

Is it a bad design for a programming language to allow spaces in identifiers?

Is it a bad design for a programming language to allow spaces in identifiers? Short answer: Maybe. Slightly longer answer: Design is the process of identifying and weighting conflicting solutions ...
Eric Lippert's user avatar
  • 46.1k
52 votes

Why did BASIC use line numbers?

On early microcomputers editing was line based. You couldn't just move freely around in the source code and edit. You had a single line at the bottom of the screen where you could type commands and ...
JacquesB's user avatar
  • 58.7k
51 votes

Can every language be categorized as either compiled or interpreted?

The answer to your question: Can every language be categorized as either compiled or interpreted? Is "No", but not for the reason you think it is. The reason is not that there is a third missing ...
Jörg W Mittag's user avatar
47 votes

In OOP, isn't the 'protected' keyword required?

It depends on what you mean by "required". Access modifiers are not a necessity. You could replace every access modifier with public and most applications will work just like they did when you used ...
Flater's user avatar
  • 48.7k
46 votes

Why did BASIC use line numbers?

If you are thinking of BASIC dialects of the 8-bit home microcomputers of 80's, then those computers did not have text editors (unless you bought some word processor application). There was no way to ...
hyde's user avatar
  • 3,744
45 votes
Accepted

What makes a scripting language "embeddable"?

Embedding a language (I'll avoid characterizing it as "scripting") means that the following has been done: The interpreter and runtime are running in the same process as the host application Enough ...
Berin Loritsch's user avatar
44 votes

Why does the type go after the variable name in modern programming languages?

Why in nearly all modern programming languages (Go, Rust, Kotlin, Swift, Scala, Nim, even Python last version) types always come after the variable declaration, and not before? Your premise is flawed ...
Jörg W Mittag's user avatar
44 votes

Why do "checked exceptions", i.e., "value-or-error return values", work well in Rust and Go but not in Java?

From a scientific point of view, checked exceptions can be seen as alternative return values, e.g. Exactly. They can be seen that way, and they should be but they aren't. Using an Error type like is ...
Jörg W Mittag's user avatar
39 votes

Programming language where every function call/block is done in a separate thread?

every function call/new block (if clauses, loops etc) will work in a separate thread. Read a lot more about continuations and continuation-passing style (and their relation to threads or coroutines) ...
Basile Starynkevitch's user avatar
38 votes

In OOP, isn't the 'protected' keyword required?

No, it's not required: Bjarne Stroustrup, explained how he naively added protected to C++ release 1.2, thinking to provide a useful feature to class developers, just to conclude only 5 years later ...
Christophe's user avatar
  • 76.8k
37 votes

Programming language where every function call/block is done in a separate thread?

You may be interested in reading about the research into data parallel Haskell. If you search around on youtube, Simon Peyton Jones has given some interesting talks related to the subject as well. ...
Karl Bielefeldt's user avatar
36 votes
Accepted

Why is there no static keyword in Kotlin?

Scala also replaces class level declarations with a 'Singleton' object. The main advantage of this is that everything is an object. In Java, static members are treated very differently than object ...
JimmyJames's user avatar
  • 26.8k
34 votes
Accepted

What is the reasoning behind naming of the .NETs Select (Map) and Aggregate (Reduce)?

This mostly comes down to the history of LINQ. LINQ was originally intended to be SQL-like, and used (largely, though not exclusively) to connect to SQL databases. This leads to much of its ...
Jerry Coffin's user avatar
  • 44.5k
34 votes
Accepted

What is a type system?

That all seems like a fine description of what type systems provide. And your implementation sounds like a reasonable enough one for what it's doing. For some languages, you won't need the runtime ...
Telastyn's user avatar
  • 109k
34 votes

Why F#, Rust and others use Option type instead of nullable types like C# 8 or TypeScript?

NULL is Overloaded. NULL simultaneously means: This variable has not been initialised This variable has been initialised, but does not point to a valid object, and as such is invalid This variable ...
Kain0_0's user avatar
  • 16.1k
33 votes

Why are packages and modules separate concepts in Java 9?

The concept of a module is different from the instantiation of that concept. Java has always had modules. A method is a module, so is a class and so is a package. A module is a unit of organisation ...
Neil Bartlett's user avatar
31 votes

Why is XML called a "language" exactly?

In computer science, formal language is just a set of strings, usually infinite and often described using rules (two common versions of those rules are regular expressions and formal grammars). Note ...
svick's user avatar
  • 10k
31 votes

Why is Arithmetic Overflow ignored?

Because it's a bad trade-off to make all calculations a lot more expensive in order to automatically catch the rare case that an overflow does occur. It's much better to burden the programmer with ...
Kilian Foth's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible