1
4 Comments

Google Carbon Lang vs Rust - Which one is better?

When Google announced Carbon programming language, immediate question that popped up is

👩‍💻How Carbon language is different from Rust❓

Working with C++, Rust, Carbon.

Which language do you prefer ?

submitted this link to Icon for group Developers
Developers
on August 14, 2022
  1. 1

    Another month, another Google programming language. Oh joy.

    I believe that Google is in a difficult situation because they have a lot of C++ code that is not compatible with the standard C++ dialect - its a very google idiosyncratic C++ dialect. They need a language that is compatible with C++ but better suits their needs.

    If you are wondering what makes carbon different from Rust or Zig, it is the ability to interoperate with a wide variety of code, including classes/structs and templates, not just free functions. Carbon is also willing to expose the idioms of C++ into Carbon code, and the other way around, when necessary to maximize performance of the interoperability layer. The use of wrappers and generic programming, including templates, also helps to minimize or eliminate runtime overhead.

    More than 7 years ago [1], someone at Google estimated that there were 2 billion lines of code in production to support Google Services. Clearly, any replacement language for C++ has to be able to seamlessly consume and update this gigantic C++ code base. That pretty much rules out Rust, Golang, and various other languages which only provide thin "extern C function" level compatibility at best. It would be interesting to see how the language progresses.

    [1] https://www.wired.com/2015/09/google-2-billion-lines-codeand-one-place/

  2. 1

    So, Carbon hasn't actually officially been released yet. But the idea behind is that it's intended to "replace" C++. Unlike Rust, it's completely interoperable with C++ meaning you can call Carbon functions from C++ and vice versa.

    Rust is intended to be an entirely standalone, low level, high performance, memory safe language.

    I haven't used Carbon (and doubt most people on IH have) - again it's not officially released yet. But I like Rust a lot. It challenges the way that you write code. It's a very steep learning curve, especially coming from a dynamically typed language, but code written in Rust is virtually guaranteed to be performant and safe.

    1. 1

      Totally true. Rust is definitely lot matured and Carbon is still in barebones. I just tried Carbon for fun (https://tipseason.com/carbon-language-tutorial-syntax/) and looks like lot of concepts were inherited by looking at most modern languages including Rust. Anyways let's wait and see how this evolves. Thanks for your detailed response.

  3. 0

    Hey, pretty nice question. So, my opinion on this question would be that every language has its own set of pros and cons. So, its better if you hire a talented full stack developer, hire backend developer or hire frontend developer as they can be a great help to you in your project.

Trending on Indie Hackers
I built a text-to-video AI in 30 days. User Avatar 52 comments I built something that helps founders turn user clicks into real change 🌱✨ User Avatar 49 comments What 300 Builders Taught Us at BTS About the Future of App Building User Avatar 35 comments From a personal problem to a $1K MRR SaaS tool User Avatar 30 comments You don't need to write the same thing again User Avatar 29 comments I built an Image-to-3D SaaS using Tencent's Hunyuan 3D AI User Avatar 25 comments