← Back to context

Comment by caim

3 days ago

Yep, that's true. But multiple immutable shared references are a form of contraction, while mutable references are actually affine.

Swift doesn't have references like Rust, and you can't even have unsafe raw pointers to variables without producing a dangling pointer, but this makes Swift more restrictive and less powerful than Rust.

> multiple immutable shared references are a form of contraction

No, they are not. You're not using a value more than once, you are borrowing it, which is an extension of affine logic but keeps true to the core principles of affinity. I have modeled multiple shared references in an affine logic (look up RustBelt), i.e. in a logic that doesn't have contraction, so we have very hard evidence for this claim.