Hacker News new | ask | show | jobs
by pedrow 1358 days ago
I was initially thrown by the example code which doesn't look like C++ at all:

    main: () -> int = { ... }
I learned this is 'Cpp2' which was also discussed by Herb Sutter recently[0]. I don't know if there is a desire for C++ (i.e. Cpp1) to become Cpp2 at some point - could this ever happen?

[0]: https://herbsutter.com/tag/cpp2/

5 comments

Frankly, I hope I'm out of the C++ eco-system by then.

Speaking of the "desire[s] for [of] C++", it's a matter of design-by-committee and we all know what sort of results this brings. Consultants love each new standard. I am happy about this, that or that other library improvement but I'd wish they'd stop fucking about with the language. Come on guys, you aren't ever going to catch up to ML or lisp or ever return to C's "dirty elegance". Just stop breaking the mental model users have of C++ with every update please?

Sorry that comment went nowhere, I'm massively frustrated with C++, its direction, and I can't wait to leave it behind for good.

But "could this ever happen?" the committee agrees on the wildest stuff, so, sure, why not.

> Sorry that comment went nowhere, I'm massively frustrated with C++, its direction, and I can't wait to leave it behind for good.

I fail to see how a "direction" of a language like C++ is of any concern to professional C++ developers. Most of C++ projects are stuck in C++14 or C++11. Projects are only migrated to newer C++ standards if there are very compelling reasons to do so. If a newer standard offers no value, projects simply don't migrated.

Lastly, why do people feel that perpetuating the C++ label is important? Those who pick the right tool for the job don't play favorites.

For what it's worth you can define main as

  auto main() -> int { ... }
in actual C++, which is not very far off.
No, the idea is to build a 'bubble' of new code that isn't subject to all the backwards-compatible flaws of the old syntax. It's just an experiment for now.
This is how I see languages that compile to C or C++ like Nim where the ease of interoperability should be similar to Cpp2
If I understand the cpp2 pitch correctly, you should be able to embed cpp2 functions inside preexisting C++ source files, so it's more like the old cppfront compiler (C++ supports basically C syntax in C++ files) than a fully transpiled syntax.
> I don't know if there is a desire for C++ (i.e. Cpp1) to become Cpp2 at some point - could this ever happen?

On the balance, I think most of the committee is weakly against some of these syntax changes. From what I've heard, the push for uniform initialization in C++11 was seen as a mistake in retrospect, and the more recent effort to push uniform call syntax wasn't popular enough to pursue further.

Cpp2 actually has a cleaner function type signature than Rust IMO. Not bad.