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
How I Closed My First SaaS Client Without Writing a Single Line of Code User Avatar 13 comments Why Building in Public Changed My SaaS Journey Forever User Avatar 13 comments Meme marketing for startups 🔥 User Avatar 12 comments From $0 to $10k MRR: My Indie Hacker Journey – Part 1 User Avatar 6 comments Protect your momentum like your life depends on It User Avatar 5 comments How do I change my username on Indie Hackers? User Avatar 2 comments