this post was submitted on 28 Dec 2023
3 points (100.0% liked)

Rust

5749 readers
172 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

[email protected]

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 1 year ago
MODERATORS
 

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!

top 7 comments
sorted by: hot top controversial new old
[–] [email protected] 1 points 8 months ago

Async traits 🀩

[–] [email protected] 1 points 8 months ago

Nice! Just in time for my yearly "I should finally learn rust" and then forget about it a week later habit.

[–] [email protected] 1 points 8 months ago

Nice! Looks like a more ergonomic, faster Rust.

[–] [email protected] 0 points 8 months ago (1 children)

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?

[–] [email protected] 1 points 8 months ago (1 children)

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.

[–] [email protected] 1 points 8 months ago* (last edited 8 months ago) (1 children)

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.

[–] [email protected] 1 points 8 months ago* (last edited 8 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.