Comparing Rust to Carbon
Posted4 months agoActive3 months ago
lwn.netTechstory
calmmixed
Debate
70/100
RustCarbonProgramming LanguagesC++Interoperability
Key topics
Rust
Carbon
Programming Languages
C++
Interoperability
The article compares Rust to Carbon, a new language designed to be a C++ successor, sparking a discussion on the merits of each language and the challenges of replacing C++.
Snapshot generated from the HN discussion
Discussion Activity
Very active discussionFirst comment
4d
Peak period
56
96-108h
Avg / period
12.8
Comment distribution77 data points
Loading chart...
Based on 77 loaded comments
Key moments
- 01Story posted
Sep 24, 2025 at 10:22 PM EDT
4 months ago
Step 01 - 02First comment
Sep 28, 2025 at 7:59 PM EDT
4d after posting
Step 02 - 03Peak activity
56 comments in 96-108h
Hottest window of the conversation
Step 03 - 04Latest activity
Oct 1, 2025 at 12:37 PM EDT
3 months ago
Step 04
Generating AI Summary...
Analyzing up to 500 comments to identify key contributors and discussion patterns
ID: 45368596Type: storyLast synced: 11/20/2025, 5:57:30 PM
Want the full context?
Jump to the original sources
Read the primary article or dive into the live Hacker News thread when you're ready.
This is true, and I think that there is a type of language that I don't think have been explored yet: Cross language ABI language.
That is, the language is fully designed for being the glue between multiple languages to allow for migration in the future. I think it would probably end up being C.
> There are several languages that have managed a transition away from a base language into a more capable, flexible successor language, though: TypeScript is an evolution of JavaScript, Swift is an evolution of Objective-C, and C++ itself is an evolution of C.
And yet none of these have fully escaped the chain of their predecessors. And that is almost the point, people actually wanted to do what JavaScript could do, what C could do, what Objective-C could do. Then we put cover on it, but it is still a wooden table at the end of the day.
Have Hyrum's Law teach us nothing? Unless you consciously make the effort to REMOVE features, it will always be there. The fact that cross language boundary is complicated is a sign that the new language is actually shedding off technical debts. If I wrote a massively complicated function in C that leaks file handles, the answer isn't to read /proc/fd before and after, then manually unlink the new FDs. The answer is to actually dig through the code or rewrite it.
Unfortunately, C is woefully insufficient for such a language. At a minimum, you'd want to have a language that can distinguish between nullable and nonnullable pointers, pointer-with-array-len (so C++'s std::span or Rust's slice), and read-only versus read-write pointers (which const only kind of does). Expressing no-alias relationships and very basic lifetime relationships is also pretty critical for several languages. Multiple return values is something I'd love to see, in addition a success-object-or-error-object (something like a Result type). Having a dedicated not-necessarily-null-terminated UTF-8 string type is also useful.
I mean, what do you do with those languages that don't have the concept of lifetime relationships, like Python? Or those in which read/write pointers make no sense (Tcl)? How about languages with linear datatypes? Or languages that don't allow self-referential data structures (like Rust)?
The only practical approach is to have an interface that is the lowest common denominator of most languages, which is what we already have with C.
I did work in CORBA in the 90s (and someone else mentions COM down below, which I also worked a little with), and the way I'd go about it[1] is similar to swig but in a CORBA/COM type fashion - an IDL that will generate bindings for specific languages. This requires quite a lot of prescient thinking - after all, lifetime ownership is a fairly new thing, so who knows what new requirement will come in the future?
In some future language, you may want FFI to encompass closures, in which case you'd have extra syntax for capture by value vs capture by reference, and you may not necessarily want ownership change in the function call (for example on a single-threaded callback function, the value captured by reference is safe for either party to modify).
Nail down the data interface and you're 80% there.
======================
[1] The best way to go about it would be using something like s-expressions: allow some basic execution to encompass every type of object a language might ever need.
I think the reverse will also be true. Any cross language API will get issues.
However on Windows, given its prevalence, especially since Vista, one would expect that by now Windows team would have bothered to make it less hairy, but elas it has never been a priority, when when they actually did something (WinRT) is was woefully mismanaged and now no one cares.
I have no doubts that is what will happen on Apple world, outside I am not so certain.
We have been here before.
The investment of Apple into a cross platform Swift ecosystem is a fraction of what Microsoft is doing with .NET, and even it isn't without issues.
Outside Apple ecosystems there are much more mature options for CLI and servers software.
Developers on Apple ecosystem are the ones that would be using Swift like that, as it also provides a good to share code between apps and server side code.
Most likely Apple will also be the only one writing firmware or OS drivers in Swift, that is where Embedded Swift project started.
"Documentation for the standard library is presently hosted on the Apple Developer website"
That's not a great sign but sure this "cross platform" software is "presently" on the company website of the obvious real owner maybe that'll get fixed in the next ten or fifty years, I'm sure it won't affect the actual documentation right?
OK, so the feature I need works on tvOS 14.0 and watchOS 7.0 - but what about Windows? That's not mentioned because this is an Apple website and so it only documents Apple products.
Case closed.
As with Go, basically every other system is just a thin attempt to emulate the system they actually want you to use and where that's impossible too bad. If you're an Apple-first developer this is probably fine. What do you mean Windows doesn't have the user-group-other permission model? Just fudge it.
The good news is Linux now adopt Rust. In the end it will be all Rust although it may take a long time to migrate from C.
Do you by chance work at Cloudflare, who has migrated away from Lua to Rust?
Curious to hear observations on productivity hit going from Lua to Rust.
Rust modules can handle any traffic themselves, instead of a split between native code and Lua that is too slow to do more than config (Lua is relatively fast for a scripting language, but on the critical path it was a "peanut butter" slowdown adding latency).
At the size and complexity of a server serving 20% of the Web, Lua's dynamic typing was scary. Modules in Rust can enforce many more requirements.
Rust's solid dependency management also helps share implementations and config logic across modules and even different products, instead of everything having to go literally through the same server.
https://blog.cloudflare.com/20-percent-internet-upgrade/
In case you’re not aware, Cloudflare ran on LuaJIT (not just for config) until not that long ago.
https://news.ycombinator.com/item?id=23856875
s/m/b/ too
My view at this point is that you are better off starting from a clean sheet of paper in Rust than trying to make Rust do C++ things it was not designed to do.
In the specific narrow case of performance-engineered code, Rust also seems to consistently produce slower code in my experience for myriad weird reasons, it isn’t one thing. In many cases I don’t even think it is the fault of the language per se, just a side effect of other factors. Nonetheless, customers don’t care about any of that, they won’t accept a performance regression just because you rewrote it.
This is a very condescending statement. In fact, for most software, when given the option of a full rewrite from C/C++ to another language, Rust is usually the least reasonable option. Fully automatic memory-managed languages should be considered first.
> People who actually use Rust known it is worth to rewrite C/C++ software in Rust, either the whole or part by part.
A full rewrite is not a feasible option for many large projects, and Rust does not make it easy to rewrite C++ code piece by piece, as the linked article clearly explains.
It's not true that developers don't like full rewrites. Most often, it's the path most developers would choose if they had enough time and funding. But in reality, you don't get either of those two.
And even if you are willing to do a full rewrite, your project probably has non-trivial dependencies on large, mature C++ libraries. You are not going to rewrite those. This is why more new projects are started in C++ every day than in Rust.
I doubt it. You can use C libraries from Rust, and emit C libraries in C++.
> because they themselves don't want to learn a new thing or because they don't want their employees spending time learning a new thing.
Whining about others not wanting to learn when you could have learned how Rust FFI works is, really, hilarious :-)
If the software was originally written in C/C++ based on some performance reasons (avoiding GC/being in control of boxing/being in control of when to use vtables etc.) then what would be more reasonable options?
> Fully automatic memory-managed languages should be considered first.
Those languages have existed for 20+ years so if they were ruled out as part of the original decision making then they probably still aren't applicable.
Plenty of software has been written in C or C++, only because they were the only compiled languages known to the authors.
Having said this, Go, D, Swift, OCaml, Haskell, Common Lisp, C#, F#, Java (with GraalVM, OpenJ9).
All of them offer ways to do AOT compilation and use value types, granted Java is too verbose using Panama for that, and one is better of choosing one of the others.
[0] https://github.com/dotnet/fsharp/issues/13398
Some examples, one per language, there are others I could list.
https://www.wildernesslabs.co/
https://tinygo.org/
https://www.ptc.com/en/products/developer-tools/perc
https://www.swift.org/get-started/embedded/
https://wiki.dlang.org/Programming_in_D_tutorial_on_Embedded...
They were ruled out when the RAM/CPU budget per $SERVER could have been an expensive 4GB/2-core for a complex server processing transactions in real-time.
Today, that same complex server can cheaply run on a 48GB/6-cpu server. Those performance constraints for exactly the same $FUNCTIONALITY are such a low hurdle, dollar-wise, that it makes no sense in most applications of this heuristic.
There are huge C++ code bases that are 15+ years old and are still actively maintained because the cost of a rewrite is too high for something that still solves the problem well enough.
Most of the large C++ projects I've worked on were written in C++ because it was the most common and mainstream language given the CPU and memory constraints of that time. We have significantly more powerful CPUs now, especially considering multicore computing, and easily 5-10x more RAM than 15 years ago. Java/Kotlin, C#, Go, TypeScript, Swift etc., are perfectly applicable to many more problem domains where C++ once dominated. I can easily agree that many C++ projects would be better off transitioning to a fully garbage-collected language than to Rust.
Of which none has solved concurrency. Some like Java prevents UB but garbage data will still be produced if you don’t diligently protect the access of the shared data.
The hope when Java developed this memory model was that loss of SC is something humans can cope with, it was not, the behaviour is too strange.
To solve interweaving, add mutexes. And once you have mutexes you'll be protected from weak memory models.
Well, the result is safe but unknowable. I would call that garbage data.
Why? If it was written in C++, there's a good chance it was so for performance reasons. You wouldn't want to throw that away with a GC.
I agree. But imagine that games like Doom or Quake would have been unthinkable if they weren't fully written in C/C++. Now, however, we have 3D game engines like Unity that expose a C# API for game logic scripting, and it seems to work just fine. Performance is becoming less of a concern for more and more problem domains.
It is like saying C libraries are Python, only because they happen to be used from Python bindings.
Both of us are old enough to remember when any useful compiled language used to allow for inline Assembly, extension or not.
The expectation is that over the next say, decade, Rust gets more trusted by Linux maintainers and perhaps grows more platform support e.g. via the GNU Compiler Collection, and simultaneously some of the dustier platforms "rust out" of Linux because the few maintainers stop caring about new Linux versions. So one day you can rewrite core subsystems in Rust if that makes sense.
Technically correct by ISO C++, in practice that isn't the way to write modern code.
Non-trivial C++ programs depend on OOP design patterns, webs of shared-mutable objects, and other features which Rust doesn't want to support (Rust's safety also comes from not having certain features that defeat static analysis).
Rust really needs things written the Rust way. It's usually easier with C, because it won't have clever templates and deep inheritance hierarchies.
Even if your goal is to move to Rust, it may make sense to start with Carbon or Circle to refactor the code first to have more immutability and tree-like data flow.
Well this was a shocker, to say the least! Why would you intentionally pick the same name as the transitionary gui framework from macos classic to macosx when the demographic you're targeting is the most likely to confuse the two terms?
At some point, it's okay to reuse names.
With Typescript, all you have to do is rename your .js file to a .ts file and then you can start addressing the warnings. With Kotlin, there's a convenient but imperfect Java to Kotlin converter that ships with Intellij. It will get you 95% there but expect to fix a few things. Basically you modify your build to add the Kotlin compiler and then you start converting files. In my case I started with some simple tests that weren't on the critical path to anything. When that worked really well, I quickly got in a mode where any Java file I worked on was converted to Kotlin. Same with Typescript. Both code bases rapidly shifted to being mostly Kotlin/Typescript but with lots of remaining Java and Javascript.
A big advantage of incremental approaches like this is that you get to focus your attention on the most critical parts of the software without really interrupting your development process. The critical parts of your software are those parts that you are actually working on regularly to fix bugs or add features. Another advantage is that you slowly get used to the new language. This takes time. In my case I had to unlearn about 20 years of using Java. Optional is not a thing in Kotlin for example. It's 100% redundant Java clutter. And finally, you organically convert most code that matters in a relatively short amount of time. So, you make rapid progress and make a big impact. Which is always a good thing when learning a new thing.
So, I can see the value of Carbon here. Start dropping it into existing C++ code bases. Upgrade files as you work on the code anyway. Put some focus on the typical hotspots where you were fixing lots of bugs anyway. This way, things improve rapidly and the last 20% of the code is the least important part of the code generally. You get diminishing returns from upgrading it. It will be nice to see what happens when this is ready for production usage.
Like with Kotlin and Typescript, expect this to stay controversial with some people. Stuff like this never fully converts the target audience. I know lots of people that prefer Java and Javascript. Mostly for irrational reasons IMHO. But they do. It all boils down to people just being a bit change resistant. And the C++ crowd is very conservative.
I will consider Kotlin outside Android, when it becomes relevant for JVM design, being taken into account by all major JVM implementations and JEP proposals, instead of something imposed by an OS vendor, stiffing Java support on purpose.
Guest languages always end up eventually going down their own path.
Not even C++ developed alongside C and UNIX, managed to take over UNIX clones, or industry standards for OS and graphics APIs.
Typescript relevance might wither away when JavaScript gains type annotations, it is after all only a nice linting tool.
Despite all WebAssembly craziness, JavaScript still rules the browser and edge gateways.
If that is irrational, oh well.
It is and you are being very defensive here. Which suggests to me that this isn't the first time you've been challenged on this front.
Dismissing things as "guest" languages maybe steps over the advantages these languages bring. If you had some rational reasons I'd take you more seriously. But you clearly don't. Using big words like "industry standards" doesn't really add to the argument.
> I will consider Kotlin outside Android
Funnily enough the only place I don't use Kotlin is Android. I never did much Android development. I've been using it since 2017 for server side development and the last five years also for browser development (via kotlin-js). It's actually replaced typescript for me. I do a lot of Kotlin multiplatform at this point. I don't recommend this to everyone. But it does work quite well for me as a better Typescript. It still cross compiles to Javascript of course. And lately to WASM if you want to. But the point is, Kotlin is not just a JVM language anymore. People do IOS native development with Kotlin now. With bi-directional swift integration, native libraries, and all the rest.
What things are for and aren't is mostly a mental block on your side. C++ and Typescript are widely used at this point.
> might wither away when JavaScript gains type annotations
If that's so beneficial, you could have been using Typescript for the last ten years.
Why did you waste ten years?
Yeah, but you started it with
>> Mostly for irrational reasons IMHO.
Leading your argument with the sentiment that "detractors are just delusional" isn't going to lead to productive responses.
You can't very well complain that someone is defending when you initiated the attack.
If Kotlin is so great where is the KVM taking over the world, outside ART, when no one is forcing its adoption like on Android?
Actually, is Kotlin Native finally good enough for JetBrains to implement a KVM, without having to rely in something writen in Java with all the related flaws?
I use Typescript where it is imposed upon myself, like Angular and Next.js, when I can have my way of Web development, it is plain Spring MVC or ASP.NET MVC with vanilajs.