4 ms·
> It’s not as safe (std::shared_ptr is not your friend), but it’s easier to get going vs dealing with lifetimes and Rustic syntax. Rust can be easy enough to g
by zozbot234 3y ago
> It’s not as safe (std::shared_ptr is not your friend), but it’s easier to get going vs dealing with lifetimes and Rustic syntax.
Rust can be easy enough to get going if you know to use .clone(), Rc<RefCell<>> and the like. Yes it's a bit heavy on boilerplate but that's about it. Also the boilerplate is helpful since it can guide a refactoring effort to make the code a bit more efficient. With Rust, "clean" code is usually fast and safe code which is not as true in other languages.
- reactordev 3y agoLess divergent code does not make better code. Rc<RefCell<>> is a prime example of "Do as we say, not as we do" in Rust that has made its way in from C++. I thought the borrow-checker was gospel and yet, here we are on the cusp of circumventing that with dynamic memory allocation checking (or lack thereof, just that it's the same size).
- zozbot234 3y agoRust has always supported some variety of Rc<…> because the borrow checker cannot account for every possible way of writing safe code. It's not something that has "made its way in" from the outside, it's just as inherent to the language as anything else in it.