Zig vs Rust. Which one is going to be future?

I think about pros and cons and what to choose for the second (modern) language in addition to C.

@[email protected]

  • xigoi@lemmy.sdf.org
    link
    fedilink
    English
    arrow-up
    0
    ·
    2 months ago

    What does Rust improve over its predecessor? The only really new thing is the borrow checker, which is only useful in very low-level programming.

    • zygo_histo_morpheus@programming.dev
      link
      fedilink
      arrow-up
      0
      ·
      2 months ago

      What do you mean by its predecessor? C++? I think rust has a bunch of advantages. For one, designing a new language today gives you the benefit of hindsight meaning that they have a more cohesive set of features and a nicer standard library compared to C++ that has some bloat and cruft as a natural result of it evolving over several decades. It’s also much easier to reason about undefined behavior in rust thanks to unsafe. Algebraic data types are really nice and traits are better than classes.

      The borrow checker isn’t just useful for low level programming. One of the other main selling points is “fearless concurrency” or essentially the fact that the borrow checker can help you reason about thread safe vs non thread safe data.