3 ms·
I don't think so. Rust has much stronger typing than Go which allows you to prevent more classes of bugs than just memory errors. The coolest one I've heard is
by IshKebab 2y ago
I don't think so. Rust has much stronger typing than Go which allows you to prevent more classes of bugs than just memory errors.
The coolest one I've heard is that Fuchsia's network stack managed to eliminate deadlocks.
But even on a basic level Rust has that "if it compiles it works" experience which Go definitely doesn't.
- Mond_ 2y ago> The coolest one I've heard is that Fuchsia's network stack managed to eliminate deadlocks. Is there a write up on this? That's very cool
- diarrhea 2y agoIIRC it is just having locks with exclusive constructors, which take previous locks’ guards (by ownership?). That way you can never lock lock B if you have not received a guard aka lock from lock A prior. Ensured on the type level. I suppose doing this at scale is a real challenge.
- jelder 2y agoThe general term for this is "Session types." The Par crate is probably the most mature attempt at this to date. https://github.com/faiface/par https://github.com/faiface/par
- aw1621107 2y agoI think that example comes from the talk "Safety in an Unsafe World" [0, slides at 1]. There are some crates which implement lock ordering as well (e.g., [2, 3]). lock-ordering states it's inspired by the technique discussed in the talk as well, for what it's worth. [0]: https://youtu.be/qd3x5MCUrhw?t=1001 https://youtu.be/qd3x5MCUrhw?t=1001 (~16:41 in case the timestamp link doesn't work) [1]: https://joshlf.com/files/talks/Safety%20in%20an%20Unsafe%20World.pdf https://joshlf.com/files/talks/Safety%20in%20an%20Unsafe%20W... (deadlock prevention example starting slide 50) [2]: https://github.com/akonradi/lock-ordering https://github.com/akonradi/lock-ordering [3]: https://github.com/alaric/lock_order https://github.com/alaric/lock_order