Conversation

Easy to say abstractly, but harder to specify exactly which features you would take out. Practical memory safety without GC requires quite a few moving parts.
Quote Tweet
it feels like there’s a smaller language hiding in Rust that’s half as powerful at the edges but 10-50x easier to read, write, and maintain
8
44
Replying to
This isn't a Rust subset, but if I were doing memory-safety for a compiled lang, I'd consider making mutability and ability to hold reference/pointer to objects mutually exclusive. Ref tracking then becomes easy without heavy runtime machinery.
3
Replying to and
Support for mutable references definitely makes it harder to design a safe language. However, Rust doesn't need any runtime machinery to support either mutable or immutable references. It deals with it by statically preventing the mutable references from overlapping with others.
1
Taking an immutable reference prevents modifying the object and taking a mutable reference prevents getting any usable overlapping references. It's definitely very restrictive, and there are alternatives to this design. Rust has Cell and RefCell as library-based alternatives.
1
There are clearly ways of doing it differently than Rust though. Many of those different approaches were considered as part of the design. There were a lot of experiments with different approaches and it ended up with the model it did largely due to practical research efforts.
1