logoalt Hacker News

tcfhgj • today at 4:57 PM • 1 reply • view on HN

> Probably, particularly in terms of writing correct code.

package management, build system, compiler errors, language simplicity (yes, it adds life times, but removes so many other things), Rust macros, language ergonomics (e.g. match, macros, enums, async, if let, etc.), not having to think about certain things going wrong (including not debugging why things went wrong)

> Rust makes [multithreaded code] painful.

Andreas Kling is switching away from C++ to Rust in Ladybird, because of exactly the reversed experience.

I have been using asynchronous multithreading via tokio - something I never dared to in C++. Alone from the compiler errors I have got doing that, I would assume that I would have been dealing with an unbearable amount of debugging of subtle memory issues.


Replies

cogman10 • today at 6:46 PM

> Alone from the compiler errors I have got doing that, I would assume that I would have been dealing with an unbearable amount of debugging of subtle memory issues.

Well, that's the thing about rust and async. It's far more restrictive (necessarily) than the bounds of safety. The hard problem rust runs into is that async functions can be executed outside of lexical and the lifetime tracking of the rust language. To be absolutely safe, rust ends up needing to assume that async can be executed with no respect to the surrounding lifetimes.

Rust would really benefit from something like structured concurrency in terms of the lifetimes of async functions.