2 ms·
A bit too fanboy, perhaps. After over a year of Rust, writing a client for a virtual world, I'm moderately happy with it. But not uncritical. - The safety sys
by Animats 5y ago
A bit too fanboy, perhaps.
After over a year of Rust, writing a client for a virtual world, I'm moderately happy with it. But not uncritical.
- The safety system is quite good. I haven't had to use a debugger on my own code. The one time I needed a debugger, the problem was unsafe code in a library I was using.
- Some kinds of data structures are difficult in Rust. Rust tries to be a functional language, sort of, in that it favors move semantics. If your problem really does involve complex in-memory state (I have a big 3D world to manage) there are substantial pain points. The lack of back pointers is a big problem. It's possible to work around this with reference-counted forward pointers and weak reference-counted back pointers. But the borrow checker doesn't help with that, and you can fail on double-borrow or double-lock situations at run time. When that occurs, it usually means a sizable redesign is needed. What's needed is single ownership with safe back pointers and compile time checking. This is a tough theoretical problem, because you have to prevent double mutable borrows by static analysis, but some people are thinking about it.
- When you've painted yourself into a corner in data structure design, it's often tempting to use "unsafe" to get out. I see too much of that in libraries. I don't use "unsafe" at all in my own code, and now and then I have to go and rewrite something to avoid it.
- Rust is overkill for many applications. Especially web services. For most web back-end stuff, Go is easier. Go also has all the libraries for web back-end stuff, mostly written and used by Google. So they're well-exercised and debugged. Also, goroutines, which are lightweight but preeemptable, avoid the problems of "async", where you have to be very careful about not being compute-bound for too long.
- After a lot of churn in the early years, error handling seems to have settled down to something reasonable.
- The "async everywhere" crowd needs to be restrained from making "async" mandatory in libraries. Their model is mostly applicable to web back-end systems where a large number of slow concurrent sessions have to be handled, those sessions don't interact with each other much, and there's not too much compute-bound work. Not everything is web back end.
- zozbot234 5y ago> Also, goroutines, which are lightweight but preeemptable, avoid the problems of "async", where you have to be very careful about not being compute-bound for too long. You know what else is lightweight and preemptable? Threads. Yes, really. Unless you're on weird platforms like Windows, you can just use threads. > making "async" mandatory in libraries AIUI, Rust includes a simple `block_on()` feature so that you can use any async library in a sync context. The old "function color" issue is greatly mitigated in Rust.