Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

it's Rust. Btw, did you see erlang or clojure? ;p


What'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.


I 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.


That'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.


The 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.)


With 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: