Live data from Hacker News

Google Launches Carbon, an Experimental Replacement for C++

thenewstack.io

191–200 of 243 posts

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

#192
post #87

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…

Golang and C++ don't serve the same purpose. Google internally sometimes uses both to the same effect but that's because Google internally has a bunch of stuff (including new kernel syscalls) that makes highly concurrent server development in C++ palatable. So why "compete" with Rust? Because C++ compatibility was never a design goal of Rust, so gradual, painless migration from C++ to Rust is a non-starter. The best…

interesting, what kind of new syscalls are these? any plan to upstream?

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

#193

Earlier quoted context omitted.

> I thought Linux was C only It won't be for long (Rust) https://thenewstack.io/rust-in-the-linux-kernel-by-2023-linu... . But I don't expect C++ to be added.

Still a maybe, and they certainly won't be rewriting any core part of the linux in Rust. While the memory safety aspects of Rust is good for security, its still an evolving language and doesn't have the same stability as C. Its the same reason why C++ hasn't been adopted.

> Its the same reason why C++ hasn't been adopted.

Among the reasons C++ hasn't been adopted for Linux:

* Nobody actually did the hard work. The Rust for Linux people have spent a lot of time actually making this possible. C++ proponents tend to just drive past "Ha, you should use C++" which they presumably think makes them seem clever but it doesn't.

* C++ doesn't have a coherent "freestanding" subset. In theory (and according to the ISO document) there's freestanding C++ but in practice you quickly find you need lots of custom runtime stuff, it's not really part of the C++ standard at all.

* Linus is trying not to be an asshole and that's not going to be helped by introducing a C++ culture where you'll routinely see sentiments like "This has a Code of Conduct so it's for fucking snowflakes".

* C++ loves implicit allocation and Linus hates implicit allocation, especially infallible allocation. Now, you could sort of fix this if you rewrote a lot of stuff, and indeed in the Rust for Linux implementation of alloc (Rust's allocation library) there are a lot of places where it does fallible allocation and doesn't offer implicit allocation.

The example of the latter which won't affect most kernel programmers but I think is easiest for a typical programmer to understand is this: In C++ or Rust, if I have a string called adjective (maybe it's "Fast") and a string called noun (maybe "Cheese", and I write phrase = adjective + noun; then we're going to get the resulting word from concatenating the two strings ("FastCheese"), right? Is this abuse of the + operator? Maybe. But it works. In Rust for Linux that won't compile. Because it's an implied, infallible allocation. To put that concatenated string somewhere there's an allocation, which could fail, and how could the + operator "fail" ? Where does the error go if this happens?

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

#194
post #82

Ugh, It may be superior in every way (I haven't had time to read up on how or why yet) but the name? Has no one at Google ever developed in the Apple ecosystem? I know it's been 10 years but still.. It's not as bad as Microsoft though, with the word "Unity" - both a game development platform and an IOC container. Had loads of fun googling help for the IOC container when 90% of the results were about the game dev plat…

Microsoft doesn't own the Unity engine, even though it uses the MS tech stack heavily. The IOC stuff though you aren't wrong on.

Not yet they don’t.

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

#195
post #129

The example to me looks like C++ is still nicer, I don't get the hate on C++ but then again most of the native work I do is gamedev. The benefit that C++ and Carbon can run together is a nice feature. It is like Objective-C++ (using ObjC + C++ together) or Swift/ObjC that worked well in gamedev as well when you needed to wire in a C/C++ game engine into iOS. For Android the NDK. I think any C++ replacement has to be…

I work on a project that is a c & c++ codebase where there isn't really a great reason for it being in those languages vs a language "with a runtime" the hate is pretty simple: - compile times - vague compiler errors - template syntax is incredibly hard to read, especially when using techniques like sfinae, or trying to write functional interfaces - really bad names for idioms (raii, sfinae, pimpl) - really bad names…

Good points though many platforms/languages have similar issues, just C++ has been around longer and has been used the most. C++ has always been a sort of peak language and probably always will be because like C, or machine code directly, everything else is built on it: virtual machines, apps, compilers, platforms etc at the root.

C++ is one of those things that when you grok it and can ship with it, everything else is easier. The years I have spent on C++ I have enjoyed because everything else looks easier and how performant it is. It is fun to code in as well. There are many ways to do things in C++ and that is a feature. I also feel like people use less dependencies and do more custom code in it but that may just be a gamedev thing. I like that style over using thousands of dependencies and less ability to control memory. While maybe it can be unsafe if done incorrectly, it surely has less attack vectors at the dependency level like other software today.

Additionally, it seems like C++ is still a language where programmers/developers control the products over all the middle layers that control modern software, like the hellscape that is project management of software today.

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

#196
post #42

> 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?

The "slow" isn't the performance of the application, but rather the ability to make changes to the language. As it is, Google can't make changes to C++ that it wants in a timely manner (if at all). Having a C++g edition where there are slight changes to the language for the Google flavor rather than the latest standard makes things even worse. From Google's perspective, the same can be said of Rust. What Google does…

I meant slow as in the time it takes for the committees approval.

What exactly does this language solve in Google’s problem domain that can’t be enforced through guidelines?

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

#197
post #172

Earlier quoted context omitted.

Swift isn't bad, and I actually enjoyed using it. What I didn't enjoy was XCode, which is a shame because they're basically inseparable.

I love Swift. And Xcode 14 is great! What don't you like about it?

The only people I've seen claim Xcode is great have never used virtually any other modern IDE, which basically all run on your hardware/OS of choice. But the IDE isn't the worst of it, the command line tooling is woeful. That the same company could come up with a great language but provide so little incentive for anyone to use it baffles me.

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

#198
post #179
post #176

Earlier quoted context omitted.

>not controlled by any company, and has a goal that no more than half the contributors to the language should be from any one company Not controlled by Google in that Google literally owns at most half of it?

No, those are two separate things which is why I listed them separately. There is the question of the governance / ownership model is (independent foundation), and the question of having a broad base of contributors to the design / implementation. What, exactly, would they need to do to satisfy you?

Not being both de facto and de iure controlled by Google would be a start.

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

#199

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…

It doesn't matter, especially with the old Carbon being mostly dead.

Just look at how successful "golang" is.

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

#200

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…

Since “C++” reads like a Carbon ion with two positive charges, they could have called it “Cation”.
Post reply on HN