3 ms·
* So is it appropriate to say that in linear types a callee says "I will use this exactly once", and in uniqueness types a callee says "I need exclusive access
by creata 6y ago
* So is it appropriate to say that in linear types a callee says "I will use this exactly once", and in uniqueness types a callee says "I need exclusive access to this"?
* Is there an obvious way to translate from one to the other?
* Rust's type system sounds a lot closer to uniqueness types than linear or affine types. So why do so many people in this thread say that Rust has affine types?
- akiselev 6y ago> * Rust's type system sounds a lot closer to uniqueness types than linear or affine types. So why do so many people in this thread say that Rust has affine types?* Rust enforces exclusive access through ownership, which is orthogonal to linear/affine typing. Linear types must be used, affine types must be used at most once. Rust's compiler doesn't force code to use types like Futures or Result, at best it emits a warning, so a missing await or match statement can compile without doing what the code is intended to do. In a linear type system, you can mark Futures and Results so that the compiler throws an error when they're created but not consumed by an operation like awaiting or error handling.