Why do I see this phenomenon? Or: why do the few languages I am learning share the C-like syntax?
Let's decompose this question into several parts.
- Why did the original designer(*) of the language adopt a C-like syntax?
- For each element of syntax design (such as those mentioned by the asker), are there legitimate reasons or arguments favoring such use?
- Why do such languages become popular? Does C-like syntax lend to the popularity of a programming language?
- Why aren't there languages with syntax crossovers from two or more languages, i.e. between a C-like syntax and another non-C-like syntax?
Why did the original designer(*) of the language adopt a C-like syntax?
A lot of programming languages have just one original designer in the beginning; some have a few; very few programming languages were designed by a committee from the beginning.
You can find interviews of these language designers on the internet. Often they will explain why the decision was made.
For each element of syntax design (such as those mentioned by the asker), are there legitimate reasons or arguments favoring such use?
The semicolon question has been asked before. If anyone has something to add, please go over the existing answers, and add a new one if your contribution is new.
The case sensitivity question has been answered by Microsoft.
For logical operators, in the early days it was widely believed that a language should provide both non-short-circuit (evaluate both) and short-circuit evaluations for and
and or
.
Example (Pascal):
- Both operands evaluated:
and
, or
- Short-circuit evaluated:
and_then
, or_else
The opinion on short-circuit evaluation has shifted in the last few decades.
The Console.WriteLine question is a result of being an object-oriented programming language. In short, in order to make a function call, it is necessary to specify whether the function is a member of the class (if it is a static method) or a member of an instance (if it is an instance method).
Aside from Console
, there are several text outputs that are commonly used in C# programming:
System.Diagnostics.Debug
System.Diagnostics.Trace
If you look at the Visual Studio project configuration page, you can find that Debug
and Trace
can be independently enabled or disabled in debug builds.
From a language design point of view, one can argue whether WriteLine
should belong to a text output, or to a string. Consider these alternatives:
"Hello world\n".WriteTo(Console.Out);
Console.WriteLine("Hello world");
The first alternative can be implemented by defining a C# extension method that has a TextWriter
as its second argument; the first argument is the string.
Why do such languages become popular? Does C-like syntax lend to the popularity of a programming language?
I will let others answer this part.
It is suffice to say that C-like syntax is not the only factor that determines popularity. Plenty of popular languages, e.g. Python, Ruby etc., do not have C-like syntax.
It is also suffice to say that the business world does not discriminate programming languages on the basis of syntax. Plenty of large corporations use Python, for example.
Why aren't there languages with syntax crossovers from two or more languages, i.e. between a C-like syntax and another non-C-like syntax?
or, alternatively,
Why aren't there languages with configurable syntax normalizations, such that two programmers working on the same source file can choose two different syntax normalizations, and perform on-the-fly syntax conversions whenever the source file is handed over?
I will let others answer this part.