Thanks! For my particular database project, the storage engine needs a lot of unsafe code because it is operating at the level of abstraction of memory management, but all of the code around it is still beautifully safe Rust. My gut feeling is that there are probably some domains where it makes more sense to write the core in unsafe Rust and some that would be better served by writing the same intrinsically-unsafe code in C and calling via FFI. Of course, the surface area of the unsafe code should be minimized in either case.
By the way, I have really enjoyed reading your posts!
I guess I'm not convinced that unsafe rust is worse than C-via-FFI. You still get to do all the same things, and don't have to futz with an interface layer. Even if a large amount of your code needs unsafe, you can still wrap it up neatly with safe abstractions, which you'd also be doing with a C library.
I don't personally perceive writing unsafe Rust to be much different than writing in C, is that not your experience? If it is significantly easier to implement in C, then it's probably worth it, but that's not been the case for me.
Likewise - your CLJS series is making me want to revist that stack, it's been a while.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thanks! For my particular database project, the storage engine needs a lot of unsafe code because it is operating at the level of abstraction of memory management, but all of the code around it is still beautifully safe Rust. My gut feeling is that there are probably some domains where it makes more sense to write the core in unsafe Rust and some that would be better served by writing the same intrinsically-unsafe code in C and calling via FFI. Of course, the surface area of the unsafe code should be minimized in either case.
By the way, I have really enjoyed reading your posts!
I guess I'm not convinced that unsafe rust is worse than C-via-FFI. You still get to do all the same things, and don't have to futz with an interface layer. Even if a large amount of your code needs
unsafe
, you can still wrap it up neatly with safe abstractions, which you'd also be doing with a C library.I don't personally perceive writing unsafe Rust to be much different than writing in C, is that not your experience? If it is significantly easier to implement in C, then it's probably worth it, but that's not been the case for me.
Likewise - your CLJS series is making me want to revist that stack, it's been a while.