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
For example, it could have had language support for the concept behind the Cell type in the standard library. It would be a lot more flexible as a language implementation rather than built as a crippled library type. I don't think it would be worth having another reference type.