Re:Ask HN: Rust or Swift for system programming?
by Manishearth on Tuesday July 05, 2016 @03:55AM
(#12034985)
Right, I refer to the concept of sharing data without necessarily involving shared ownership.
I am aware of inout, but like you said it's not as flexible. I find myself reaching for class types in Swift a lot more than in Rust.
inout works for sharing that is extremely local, but more complicated sharing in larger codebases is hard.
If you are referring to borrowing, Swift's answer is not class types, but inout. inout is not as flexible as Rust references, but it does not use reference counting. In most places where a Rust function would return a mutable reference, the analogous Swift function would take a closure that accepts that something as an inout.