News for hackers. Stuff that matters.
Re:Why Rust mutexes look like they do by planetis on Monday April 04, 2022 @04:39AM (#30904480)
I think the main reason rust mutexes look the way they do, is the lack of a 'try finally' construct which is emulated with a destructor. In Nim (you can have both) but I prefer using a template that uses 'try finally' and is indented so you can tell this code is inside the critical section. Also there is an .lock annotation which ties some data with a specific lock, so accessing them without locking is a compile-time error. A much more flexible design than Rust's.

There are no comments on this comment yet.