←back to thread

155 points samuell | 2 comments | | HN request time: 0s | source
Show context
kjksf ◴[] No.44749375[source]
I think this page describes "what" but not "why" of Carbon.

Carbon exists so that it's possible to migrate a large C++ code base, like Chrome, from C++ to something saner, incrementally.

The most important attribute of Carbon is not the specifics of the syntax but the fact that it's designed to be used in a mixed C++ / Carbon code base and comes with tooling to convert as much of C++ as possible to Carbon.

That's what makes Carbon different from any other language: D, Zig, Nim, Rust etc.

It's not possible to port a millions line C++ code base, like Chrome, to another language so large C++ projects are stuck with objectively pretty bad language and are forced to continue to use C++ even though a better language might exist.

That's why Carbon is designed for incremental adoption in large C++ projects: you can add Carbon code to existing C++ code and incrementally port C++ over to Carbon until only Carbon code exists.

Still a very large investment but at least possible and not dissimilar to refactoring to adopt newer C++ features like e.g. replacing use of std::string with std::string_view.

That's why it's a rational project for Google. Even though it's a large investment, it might pay off if they can write new software in Carbon instead of C++ and refactor old code into Carbon.

replies(14): >>44749770 #>>44750227 #>>44750232 #>>44750657 #>>44751685 #>>44751728 #>>44752039 #>>44752523 #>>44752948 #>>44753844 #>>44754061 #>>44756351 #>>44758133 #>>44758430 #
germandiago ◴[] No.44758430[source]
In which way is C++ an "objectively pretty bad language"?

I have done C++ for a living and it is not the easiest but there is tooling and warnings as errors that catch a lot of the errors before even you make a mistake.

It is true that packaging is more challenging but it is also true that it is very configurable ro squeeze performance as much as possible (which is on of C++'s niches). And by squeezing I mean beyond setting a release build. You could for example decide to go with LTO + PGO + remove position independent code and do static linking for all dependencies, for example.

You can do virtually anything that no other language can do and whwn you need it, believe me it is useful.

But you can still code every day code wirh your lambdas, ranges, smart pointers and virtual interfaces.

I understand C++ has some baggage but is is very far from being an "objectively bad language" in ly opinion. More so if you take into account its performance and library availability, which is second to none for almost any task, except maybe for the typical enterprise-like Java app or web stuff, byt niw C++26 will include reflection and annotations, so this could be a game changer.

replies(1): >>44759063 #
1. twoodfin ◴[] No.44759063[source]
Explicitly and between the lines, Carruth and Google have made it clear that the “bad” part of C++ from their perspective is the standards committee.

In particular, the committee’s unwillingness to make ABI-breaking changes to the language, or more abstractly, to consider the needs of organizations with huge active code bases at least as seriously as those with huge legacy code bases.

replies(1): >>44764947 #
2. germandiago ◴[] No.44764947[source]
I understand but there are trade-offs there.

Maybe a hybrid approach should be done byt breaking ABI in a so Core-supported language can cascade into so many places.

People say that Rust is great bc of that but that is just a trade-off and anyway there are olenty of dependencies like Boost, Abseil or others that can play that role anyways