News for hackers. Stuff that matters.
Re:Redox: A Rust Operating System by devit on Tuesday September 29, 2015 @10:37AM (#10296583)
Rust, among other things, prevents mutable aliasing, allows to create non-escaping pointers and provides deterministic destruction and unique ownership.

These things are essential if you don't have a GC but have a way to free memory, because the bugs they prevent would result in accessing reading or writing memory at invalid addresses.

That's not a problem with a GC, but they are still very useful because they prevent these issues that cannot be statically prevented in Java/JavaScript:

- Exceptions due to one part of the program manipulating a data structure while another is accessing it: the canonical example is someone iterating a dictionary while something else mutates it

- The program keeping a reference to mutex-protected data after unlocking the mutex

- Two threads manipulating the same object, causing races

- Something accessing a File that is closed, or in general a type in an unexpected state (this is because with a GC you can't "destroy" the previous object, but merely set it to a "closed" state that you can't statically check)

- Exceptions due to null pointers

So in general Rust is a safer language than Java, JavaScript and languages equivalent to them.

There are no comments on this comment yet.