2 ms·
tl;dr: Safety, speed, borrow checking, algebraic types and pattern matching, error handling, scoped resource management (the Drop trait), traits, first-class wa
by sshine 2y ago
tl;dr: Safety, speed, borrow checking, algebraic types and pattern matching, error handling, scoped resource management (the Drop trait), traits, first-class wasm support, tooling.
What's not explicitly mentioned, but may be implied:
- Rust got rid of implicit nulls!!!
- Explicit control of mutability.
An imperative language where you have explicit control of mutability, is a great alternative to a purely functional programming language.
And yes: it's not simple, compiling takes time, and the syntax is noisy.
> f32 and f64 does not implement Ord
Is NaN greater or smaller than -Inf?
At least Rust is honest about this being nonsense!
Both f32 and f64 implement PartialOrd, which is even an improvement over Haskell's trait hierarchy:
https://doc.rust-lang.org/beta/std/cmp/trait.PartialOrd.html#required-methods https://doc.rust-lang.org/beta/std/cmp/trait.PartialOrd.html...
I think this is the general thing I like about the Rust ecosystem: You can expect that people seek to model a domain with afterthought. Like not favoring convenience in the common case over saying wrong things at the edge. There is, admittedly, a lot of drive-by coding where some domains are littered with half-done crates nobody pushed to in 5 years.