What alternative to C++?

What language is the best candidate to replace C++ after 35 years of existence and millions of crashes due to its unsafe syntax?

A successor to C++ must produce very fast applications and code working on all platforms. But we can also speak of succession to a language that uses exactly the same syntax then C, adds classes and provides more advanced functions. So, a modern C++ even if it is not intended to replace it everywhere.

Vala (2002)

Available at Gnome, look like a demonstration of GObject, written by the same team. Vala replace C++ on the Gnome platform.

Features:

Simple example:

int main () {      
   print ("Hello World\n");         
   return 0;  
}

Class:

class Hello : Object {      
    void bye () {          
          stdout.printf ("Hello World\n");     
    }  
} 
   
var example = new Hello ();
example.bye(); 

Many programs have been written in Vala, but even if it can be used outside the Gnome environment, it is essentially in combination with GTK. The project is still active in 2022 with a new website, vala.dev.

D (2001)

Designed as an alternative to C++ with simplifications such as dynamic arrays.

Simple example:

import std.stdio;     

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

Class:

class Hello  {
  char[] content;
  this(char[] str)   {        // constructeur 
    content = str;
  }

 void display()  { 
   writeln(content);      
 }
}

Hello hello = new Hello("Hello World!");

C# (2000)

Since the Roslyn platform, available on GitHub, C# can be compiled into binary code rather than bytecode, and it can access the system resources, so even if it was originally an alternative to Java, it becomes a possible replacement to C++, for applications where the garbage collector is not a drawback.

Features:

Simple example:

void Main() {
    Console.WriteLine("Hello, World!");     
}

Class:

public Class Point : Shape {
   public int x, y;
   Point(int x, int y) {
      this.x = x; 
      this.y = y;
   }
   public void move(int w, int h) {
      this.x += x;
      this.y += h;
   }
}

Point p = new Point(0,0);
p.move(100,50);

Dart (2013)

Designed as an alternative to JavaScript with the syntax of C, this is not a system language, but it can replace C++ for scripting on the server or the desktop with a speed close to that of Asm.js.

Simple example:

void main() {    
   print('Hello World!');  
}

Class:

class Point {
   num x, y;
   Point(this.x, this.y);   // constructeur
   void move(num xo, num yo) {     
     x += xo;
     y += yo;
  }
}

var p = new Point(0, 0);
p.move(100, 50);

Other languages

There are other languages ​​derived from C or to have a vocation to replace C++ as system language.

Finally, what successor to C or C++? If we rely on the classification of languages ​​by popularity, none yet! C remains the most widely used language and C++ stands in third place, after Java and before C#.
The emerging trend is that a set of languages, each in a specific field: game development, web application, scripting, etc ... may very well together replace C++, a universal language that can not be replaced everywhere by a single language.
This gives its only real advantage to the syntax derived from C: the programmer can pass more easily from one language to the other to make different types of applications.

Programming and data languages Asm.js - Basic - C - C++ - C# - Dart - Go - Java - JavaScript - Julia - Pascal - PHP - Prolog - Python - Ruby - Rust - Scala - Scriptol - Swift - TypeScript - HTML - Wasm - XML - XAML - SQL