Live data from Hacker News

Google Launches Carbon, an Experimental Replacement for C++

thenewstack.io

61–70 of 243 posts

Re: Google Launches Carbon, an Experimental Replacement for C++

#61
I'm jumping into this a few hours late, but nobody has actually straight up asked the real question: Why try to compete with Rust while not really being a better Rust? The linked article generally defines a language that is more of the same, while Google is throwing Go under the bus to make it happen.

The number of current and former Google employees that transitioned from being Gophers to being Rustaceans that I know of is basically a 100% conversion rate. Nobody at Google will use Carbon, nobody outside of Google will use Carbon.

It's going to be worse than the Swift implosion.

Re: Google Launches Carbon, an Experimental Replacement for C++

#62
post #23

I'm probably just biased, but to me the problem with modern C++ is its complexity. The mental model of the language, its syntax, and the amount of history / number of interfaces a programmer needs to be familiar with to be productive are all too large. Rust isn't any more complex, but it's not radically simpler either. Carbon doesn't look like it solves this problem. It would seem that creating a language that is exp…

to me that's the greatest benefit of C++ and hence why it's so successful. it's kitchen sink language. choose what features you want. choose your own style. you wanna do OOP | DOP suit yourself. that versatility is why C++ is unmatched in terms of where it's deployed.

That's great if there is one developer working on each component of the software. The moment you have people trying to do cross-component changes, or developing someone else's component, they don't just have to learn how the code works on a domain level, but also the features of the language the code is using.

Re: Google Launches Carbon, an Experimental Replacement for C++

#63

I'm jumping into this a few hours late, but nobody has actually straight up asked the real question: Why try to compete with Rust while not really being a better Rust? The linked article generally defines a language that is more of the same, while Google is throwing Go under the bus to make it happen. The number of current and former Google employees that transitioned from being Gophers to being Rustaceans that I kno…

> Why try to compete with Rust while not really being a better Rust?

The linked article explains this: classes defined in C++ can be used in Carbon and vice-versa. It even suggests you stick to Rust if that's not what you need.

Edit: Oops, I assumed that the "linked article" was the github page[1] for Carbon, which is a lot more useful.

[1] https://github.com/carbon-language/carbon-lang#why-build-car...

Re: Google Launches Carbon, an Experimental Replacement for C++

#64

> Complains C++ evolution is too slow due to enforced standardizations by committee. > Introduces yet another non standardized, corporately backed Rust look-alike language. What's gonna happen when we have 5 of these things crawling around, are they going to be compatible with each other?

I haven't used Rust much, but based on everything I've read it seems like if you need a better alternative to C or C++...Rust is pretty much the answer. Is that not accurate?

> if you need a better alternative to C or C++...Rust is pretty much the answer. Is that not accurate?

If the thing(s) that you're looking to "better" about C++ are its atrocious compile times and/or the C++ culture's even more atrocious shared aesthetics, then the answer is "no".

Re: Google Launches Carbon, an Experimental Replacement for C++

#65
post #28

Earlier quoted context omitted.

I haven't used Rust much, but based on everything I've read it seems like if you need a better alternative to C or C++...Rust is pretty much the answer. Is that not accurate?

This comment and parent comment don't appear to have read the article. It's specifically targetting C++ compatibility, that means compatible threading model, memory model, ABI, type system, ... Rust has none of these. For every line of Rust code in the world, there are likely 10e3 - 100e3 lines of C++. You can either label it all "legacy code" and pretend your employer has the budget or time to rewrite it all, or you…

Google rewrites a lot of their software components from scratch every few years, at least according to section 2.11 of this paper: https://arxiv.org/pdf/1702.01715.pdf

Re: Google Launches Carbon, an Experimental Replacement for C++

#66
How to make your replacement for a C language Google-able: name it after an API for a C language:

Carbon was one of two primary C-based application programming interfaces (APIs) developed by Apple for the macOS (formerly Mac OS X and OS X) operating system.

Compare also keywords or key terms:

Carbon will be built on a foundation on modern programming principles, including a generics system, that would remove the need to check and recheck the code for each instantiation. Another much needed feature lacking in C++ is memory safety. Memory access bugs are one of the largest culprits of security exploits. Carbon designers will look for ways to better track uninitialized states, design APIs and idioms that support dynamic bounds checks, and build a comprehensive default debug build mode. Over time, the designers plan to build a safe Carbon subset.

Versus...

Carbon libraries are extensively cleaned up, modernized and better "protected". While the Mac OS was filled with APIs that shared memory to pass data, under Carbon all such access was re-implemented using accessor subroutines on opaque data types. This allowed Carbon to support true multitasking and memory protection, features Mac developers had been requesting for a decade.

https://en.wikipedia.org/wiki/Carbon_(API)

Go Get 'Em!

Re: Google Launches Carbon, an Experimental Replacement for C++

#67
post #39

Is there already a substantial amount of this in Google’s repos? It would be in character for them to reveal this after it’s already well-established internally.

There's enough gaps in the specification (move/copy situation in particular) that would make me hesitant to use this for any production code. Given that the code seems to date from WG21's rejection of the Google-led "we want to add a hard ABI break in C++23" proposal, the project is barely 2 years from literal first commit, which is likely too short to attract any substantial internal usage.

Re: Google Launches Carbon, an Experimental Replacement for C++

#68

> Complains C++ evolution is too slow due to enforced standardizations by committee. > Introduces yet another non standardized, corporately backed Rust look-alike language. What's gonna happen when we have 5 of these things crawling around, are they going to be compatible with each other?

We have more than 5 C++-alike languages that are crawling around already. In some ways they have portions of mutual compatibility. But in practice this only matters if you decide to embrace the complexity of five different programming languages when building your software. It's already somewhat challenging for projects to manage assembly, C, and C++.

assembly, C, and C++ is one of the most "standard" things to do out there. Unless you are talking about non-standard toolchains of course (everything that isn't clang or gcc based). C++ is mostly a superset of C so all the C++ compilers out there have pure C modes, and assembly integrates really well into C and C++ build systems.

Re: Google Launches Carbon, an Experimental Replacement for C++

#69
post #2

It’s clear that the value promise of Carbon is to make it attractive to port existing C++ applications to it. But how this is accomplished, article does not go into detail in this. Is there going to be ABI compatibility with C++? What are the features that make Carbon a better porting target than Rust?

There is ABI compatibility insofar that Carbon will be able to integrate C++ at the AST level within the compiler.

This is quite smart as you are basically getting ABI compatibility for free. Assuming you have the source code to the C++.

I'm not sure how it will work with dynamic or proprietary libraries, but as I understand it that is already a technically unsolved ABI problem with C++.

Re: Google Launches Carbon, an Experimental Replacement for C++

#70
post #4

I’m a big fan of ‘var’ and ‘let’ in Swift. Easier to identify mutable vs immutable variables. I believe Carbon uses the same convention? https://github.com/carbon-language/carbon-lang Helps with quick auto-completion, and someday when I get to dictate code, fewer mistakes.

Nim also uses 'var' and 'let' for mutability. I like it as well.

knowing neither of these languages i’d rather it be labeled something more clear as neither one of those screams immutable to me. the immutable variant should use the ‘const’ keyword instead.
Post reply on HN