C++: “the good parts”

Herb Sutter has an interesting proposal

The new “basic Hello-World with a single method call” would look something like:

```
main: () -> int = {
  hello("World\n");
}

hello: (msg: _) =
  std::cout << "Hello " << msg;
```

I guess the “pressure from Rust” is a good thing here (not to mention the Cambrian explosion with Zig, Vala, Kit etc).

Some highlights:

An alternative syntax would be a cleanly demarcated “bubble of new code” that would let us do things that we can never do in today’s syntax without breaking the world, such as to:

  • double down on modern C++ (e.g., make C++20 modules and C++23 import std; the default);
  • remove unsafe parts that are already superseded (e.g., no unsafe union or pointer arithmetic, use std::variant and std::span instead as we already teach);
  • have type and memory safety by default (e.g., make the C++ Core Guidelines safety profiles the default and required);

An alternative syntax would be a cleanly demarcated “bubble of new code” that would let us do things that we can never do in today’s syntax without breaking the world, such as to:

Definitely something to watch and see where it goes 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s