3 ms·
>It starts from a marketing position of "Safety With No Compromises" on runtime metrics like performance or whatever, then when things get hairy it's always "We
by nemothekid 1y ago
>It starts from a marketing position of "Safety With No Compromises" on runtime metrics like performance or whatever, then when things get hairy it's always "Well, here's a very reasonable compromise".
Well, yes. The other compromise is the one Java gives you: write a state of the art garbage collector and include it in your program.
This complaint is very annoying because it assumes a garbage collector is "free" and Rust decided to just not give you one. If you want memory safe trees your options are
* A slow, simple, reference counted garbage collector
* A fast, complex, garbage collector
both are compromises! You are just ignoring the second one.
- ajross 1y agoWell, in some sense. But in practice, come on: "write your own slow simple reference-counted GC" is a rather more expensive compromise than "just use Java or Go or whatever, it's faster and simpler for your problem". Aside from all the nitpickery about runtime implementation, the rustacean community has a serious problem with compromise in general. If you whine in a python/Go/Java/whatever forum about performance, they'll point you to their FFI and show you how to get what you want via C++ integration, because clearly no environment is going to be perfect for everyone. But come at rust with a use case (cyclic data structures here) for which it's a poor fit and everyone goes blue in the face explaining how it's not really a problem. It's exhausting.
- creata 1y ago> But come at rust with a use case (cyclic data structures here) for which it's a poor fit I'm not even disagreeing in general that Java is likely to be better for most problems. But the options in Rust for cyclic data are actually fine: * You can use integer indices into an array instead of pointers. * You can use unsafe and raw pointers, and be in the exact same situation as C++. The doubly linked list in the standard library is a cyclic data structure does that.[1] * You can use reference counting (std::rc)[0]. This is literally a garbage collector in the standard library, equivalent to C++'s std::shared_ptr. These are all simple. None of them is as complicated as "write your own GC". [0]: https://doc.rust-lang.org/stable/std/rc/ https://doc.rust-lang.org/stable/std/rc/ [1]: https://doc.rust-lang.org/std/collections/struct.LinkedList.html https://doc.rust-lang.org/std/collections/struct.LinkedList....