4 ms·
it's Rust. Btw, did you see erlang or clojure? ;p
by archrabbit 9y ago
it's Rust. Btw, did you see erlang or clojure? ;p
- striking 9y agoWhat's the point of writing your program in Rust if it's almost entirely wrapped in `unsafe{}`? You'd be better off just writing a C program. It could even be clearer to a wider audience what exactly you're doing.
- archrabbit 9y agoI probably could wrap in the `unsafe` block just the invocations to the system calls. I'm learning Rust and I wanted to give the post some freshness. There are already a plethora of examples in C.
- tiles 9y agoThat's a bizarre argument; the post is about writing an abstraction over another interface, and it's clearly meant to be extended. The abstraction can be written in a safer language than C. Seems like there's an obvious upside.
- gtirloni 9y agoWith Rust you can at least have some certainty of where problems could happen. It gets boxed inside unsafe and affords extra scrutiny. You don't have to worry much about everything else surrounding you code. Disclaimer: only went through basic tutorials and I don't program in Rust daily.
- deathanatos 9y agoThe large unsafe call inside pivot_root is much larger than it needs to be. It only needs to encompass the mount() call in that function. It's a pretty trivial change to have it only wrap the if. (Though it could wrap less, but that would either look uglier or need a variable binding the result, which honestly wouldn't be that bad either.)