Rust, verlan of programming languages

Designed by Mozilla to make a new browser, "Servo", the Rust language is available on Github and interests system programmers who see it as a possible successor to C++ in their field. The study of the language, however, let regret that it is not a true successor to C.

The word "rust" means red hair in old English and can be an allusion to the fox, symbol of Mozilla.

Rust could be the new C to which would have been added dynamic arrays, objects, pattern matching with mixing of different types, automatic memory management.

It is not the case, the latter is the only real advantage in this "new" language, which is a hackneyed of old principles with new reserved words and deliberately unreadable syntax to give a more scholarly air. There is no consistency in the language that seems to try to be different for the principle and not for efficiency, as we will see.

Demonstration by comparing the elements of Rust with those of C or C++ or with a new imaginary C completed by these new elements present in all recent languages​​.

Display in the console.

Rust

fn main() {
println!("Hello World!");
}

C

void main() {
puts("Hello World!");
}

Displaying a string.

Rust

let str = "why not make it complicated";
println!("str: {}", str);

C

char *str = "when it could be simple";
puts(str);

In Rust, all local variables are declared by let and are constants! We must add the mut specifier, to be able to reassign them...

Variable in Rust

let a = 1;
a += 1; // Error!

Constant in C

const int a = 1;
a += 1; // Error!

A 'mutable variable' in Rust is a variable (as the name indicates) in C!!!

Mutable variable in Rust

let mut b = 2;
b += 1; // Ok

Variable in C

int b = 2;
b += 1; // Ok

The type is determined by inference, but as it can be ambiguous (and therefore unsafe, it should be noted) the possibility of explicit declaration is added as an option. The coercive nature of the language would have required it the default syntax.

Explicit types in Rust

let b : int = 2;
let ch : char = 'x';

Explicit types in C

int b = 2;
char ch = 'x';

Tuples are mixed lists. An array has the same purpose in other languages.

Tuple in Rust

let t = (4, 5.0, false, "hello");

Mixed array in new C

array t = { 4, 5.0, false, "hello"};

The switch structure is renamed match to be modern. The bottom line is that it is more elaborate, as in Scala.

In conclusion, Rust was designed as a system language to replace C++ with a safer memory management, a point we do not deny. Was it necessary to achieve this change by making the syntax so obscure? The motivations of the authors are not clear because the defects of C, such as semicolons (an error according to the authors themselves) and curly braces are retained, but the simplicity of the declarations is not.
The possibilities of the elements of the language were also restricted to reduce the risk of errors. This is something that did not turned well in the past to Pascal or Modula.

Should we use Rust, so choose between it and Go or C++? We will put go aside because it rather competes with server languages ​​like Java, Python , PHP, the garbage collector is not always desirable and online modules is even less, and the lack of generics.
It remains to choose between the insecurity of C++ but with total freedom and the ability to achieve what you want, or deal with the abstruse syntax of Rust for a safer memory management.
I give my opinion in verlan : "Dema dingaccor yourto rencefepre". It is wiser.