←back to thread

Pitfalls of Safe Rust

(corrode.dev)
168 points pjmlp | 1 comments | | HN request time: 0.207s | source
Show context
sgt ◴[] No.43603859[source]
Golang might be better for writing robust software, if that is the goal. Robust services that don't go down.
replies(7): >>43603900 #>>43603904 #>>43604076 #>>43604231 #>>43604239 #>>43605174 #>>43605256 #
IshKebab ◴[] No.43604239[source]
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.

replies(1): >>43604273 #
Mond_ ◴[] No.43604273[source]
> 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

replies(2): >>43604535 #>>43604580 #
diarrhea ◴[] No.43604535[source]
IIRC 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.

replies(1): >>43610342 #
1. jelder ◴[] No.43610342[source]
The 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