3 ms·
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 bo
by planetis 5y ago
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.