Traits now support async fn and -> impl Trait (with some limitations), the compiler got faster, version = in Cargo​.toml is now optional, and many small functions have been stabilized!

  • Sanchokan@kbin.social
    link
    fedilink
    arrow-up
    0
    ·
    6 months ago

    Sorry to ask, is Rust derived from another language? I know some c++, would that benefit me if I want to learn Rust?
    What is powerful about Rust in comparison to other languages?

    • xav@programming.dev
      link
      fedilink
      arrow-up
      1
      ·
      6 months ago

      I find it’s a mix between ML languages and C++, and knowing one of them would help yes. If you’re tired if chasing a wild pointer because of a subtle use-after-free in a multithreaded monster under gdb, you’ll love #rust.

      • tatterdemalion@programming.dev
        cake
        link
        fedilink
        arrow-up
        1
        ·
        edit-2
        6 months ago

        Honestly the only things that are similar to C++ are small amounts of C-like syntax, RAII, smart pointers, and iterators. And even so, Rust improves those features a lot. The list of things that Rust rejects from C++ is much larger; Rust does not have:

        • new and delete (perhaps discouraged in modern C++)
        • function overloading
        • inheritance (replaced by composition or traits)
        • friend classes (replaced by modules)
        • exceptions (replaced by Result values)
        • 6 different kinds of first-class constructors (hallelujah)
        • templates (replaced by constrained parametric polymorphism)
        • variable mutability by default

        Rust does OOP very differently and leans harder into functional paradigms.

        • xav@programming.dev
          link
          fedilink
          arrow-up
          1
          ·
          edit-2
          6 months ago

          You could argue that C++'s new is Rust’s Box::new, and delete is replaced by RAII. Same concepts but way better ergonomy.

          • arades@feddit.ch
            link
            fedilink
            arrow-up
            1
            ·
            6 months ago

            box::new is pretty directly analogous to std::make_unique (factory for unique_ptr), in general rust’s heap allocating types map to c++’s smart pointer types, which are basically universally recommended over raw new/delete. So another column where rust just gives you the one best C++ feature where it still has 4 supported versions.