3 ms·
Trying to replace C with something like Rust, is essentially saying that we should rewrite all kernels in Rust. C is the common language because it talks to the
by bArray 4y ago
Trying to replace C with something like Rust, is essentially saying that we should rewrite all kernels in Rust. C is the common language because it talks to the kernel, which talks to the hardware.
Forgetting how much would need to be replaced with objectively much slower code, Rust simply cannot do some things. You cannot always make absolute guarantees about memory safety for example when it comes to low-level programming. Sometimes to be fast, you have to make assumptions and take risks.
I am currently watching the Veloron game [1] as an example of how larger Rust projects may begin to look. I see something like this [2] and it doesn't look all dissimilar from C, just with a new syntax. Has writing this game eliminated all bugs? Nope [3]. Maybe there are less segfaults and bad memory management, but this was just one class of bugs.
[1] https://gitlab.com/veloren/veloren https://gitlab.com/veloren/veloren
[2] https://gitlab.com/veloren/veloren/-/blob/master/server/src/connection_handler.rs https://gitlab.com/veloren/veloren/-/blob/master/server/src/...
[3] https://gitlab.com/veloren/veloren/-/issues/?sort=closed_desc&state=opened&first_page_size=100 https://gitlab.com/veloren/veloren/-/issues/?sort=closed_des...
- kaba0 4y agoWell, rust (and c++ as well) is that much better than c because it actually allows proper abstractions on a language level. You can’t even write a general purpose vector data structure in c, which doesn’t have an overhead.