3 ms·
You could if you had only linear-typed mutable and refcounted immutable. Refcounted immutable obviously could not contain pointers to linear typed mutable thing
by aaronblohowiak 13y ago
You could if you had only linear-typed mutable and refcounted immutable. Refcounted immutable obviously could not contain pointers to linear typed mutable things. That would be much simpler, just as safe and require no GC.
- pcwalton 13y agoWell, you'd have no multiply-owned mutable state then, which would prohibit a bunch of useful things (such as implementing the DOM in a browser). In any case, you just described basically how Rust the language works: the ref-counted mutable types are all just part of the standard library, implemented with unsafe code but exposing a safe interface. The only mutability in the language itself is through linear types.