3 ms·
As someone who absolutely loves Rust, I think this is a really excellent critique of the language for a very specific reason: many of the issues listed here are
by stouset 8y ago
As someone who absolutely loves Rust, I think this is a really excellent critique of the language for a very specific reason: many of the issues listed here are the result of intentional tradeoffs or hard problems that are a consequence of the language's design. I personally think Rust makes the right call on many of these decisions, but it's very worthwhile to have a sober look at the cost.
Rc/RefCell/Box are verbose because they deal with shared ownership, and Rust forces you to solve problems around shared ownership that other languages don't. This is usually a good thing, but in times where you do require this type of architecture, there's a verbosity cost. Arguably the real tradeoff here is a loss of brevity for a gain in correctness.
Non-const global objects has definitely been a pain point for me. `lazy_static!` has always felt like a hack (although a community member released a possibly-better alternative just today[1]). I personally think HashMap literals might make much of the pain here go away.
`Wrapping<u32> + u32` is a result of Rust avoiding doing implicit coercion, which has advantages but also comes at the cost you've enumerated here.
[1]: https://www.reddit.com/r/rust/comments/9406rl/once_cell_a_lazy_static_without_macros_and_more/ https://www.reddit.com/r/rust/comments/9406rl/once_cell_a_la...
- childintime 8y ago> Rc/RefCell/Box are verbose because they deal with shared ownership, and Rust forces you to solve problems around shared ownership that other languages don't. Would there be a space for a mode inside Rust, call it a DSL if you will, where Rust behaves like those other languages? I mean that in this mode it would use the heap by default and copying to not alert the borrow-checker?
- steveklabnik 8y agoIt could work, but there hasn't been a ton of demand for it. Yes, it might help at the very beginning, but people do learn and become productive without it. It'd also be a worry if libraries started doing stuff like this; it'd be harder to use from "normal" Rust.