How are created programming languages​​: variable declaration

Programming languages ​​like to be different. Example: simply declaring a variable.

In this second part of the article: How to create a programming language​​, this time we are studying how variables are declared. It seems that two lines were followed, that of Pascal and that of C, also with a bit of BASIC.

Pascal language (1970): Very formal, it was estimated that combining declaration and initialization, that's too much at once, under the inspiration of Basic (see below).

var x : Integer;
x:= 10; 

Language C (1972), C++ (1980), Java (1994), C# (2000): The shorter the better, one seems to think, if we consider the number of programs written in these languages​​. But under the influence of Pascal (what the author later said to regret), he adds to C the ending semicolon and that will be emulated by Java and C#.

int x = 10;

Erlang (1986): The lesson of C is comprised.

int x = 17; 

JavaScript (1995): Like C but without type, and semicolon optional because it is not clear whether it is useful.

var x = 10

OCaml (1996): C found the formula, let's keep it.

int i = 17; 

Scala (2004): It would be too simple, back to Pascal but with the shortcut from C, Int instead of Integer and the semicolon is kept.

var x : Int;

Langage Go (2009): We come back to Pascal's syntax but without semicolon which is useless in fact.

var x int = 2

Dart (2011): It does not follow Go and comes back to the simplicity of C. But semicolon is back because it would be too easy otherwise.

int x = 10;

TypeScript (2012): No agreement for simplicity, we return to Pascal, but with a number type such as in Scriptol (I like to note it) ... And the semicolon is back.

var x: number = 6;

In this contest of unnecessary complication , the winner is actually the first.... BASIC (1964).

10 Dim x As Integer  
20 x = 10

At this time, one does not imagine to declare a variable and assign it at the same time! But at least there is no semicolon, because we knew from the outset that it is useless ...

Speaking like a coder

Speaking like a coder

What we can do with variables, why not do it with data structures?

Authors of Go did it:

type name struct {

This is strongly reminiscent of the record structure of Pascal:

type name = record

In conclusion, when one want to innovate in creating a programming language, the style of C is dropped and one returns to that of Pascal!