5 ms·
Borrow checking allows even structures that support mutation to be safely (checked by the compiler) treated as immutable, and thus as values. Clojure also reco
by stuhood 7y ago
Borrow checking allows even structures that support mutation to be safely (checked by the compiler) treated as immutable, and thus as values.
Clojure also recognizes the connection between ownership and mutability in its "transients": https://clojure.org/reference/transients https://clojure.org/reference/transients ... compile time borrow checking extends that idea to an entire language.
- casion 7y agoWhat do transients have to do with ownership? They are simply a way to gain new performance characteristics from an existing data structure.
- stuhood 7y agoThe thing that makes it safe to use mutation in the context of a transient is that you can know with certainty that you have exclusive access to the value (because no other viewer has observed it yet). This is also what borrow checking can guarantee: except in significantly more positions in the code, and at compile time rather than runtime.
- truth_seeker 7y agoNice explanation