[swift-evolution] [Proposal] Property behaviors

On Dec 18, 2015, at 3:56 PM, Kevin Ballard via swift-evolution <swift-evolution at swift.org> wrote: > Ultimately, I would love to have non-copyable structs in Swift. But the only way to really do that is to have references in the language (otherwise the moment you call a method on a non-copyable struct, you've lost the struct as the value is moved into the method). And if you have references, you really want them to be safe. Personally, I'd love to have the power of Rust's borrowchecker and lifetimes system, but as I mentioned in another thread recently, there is a pretty steep learning curve there. Me too. Two caveats: - The model in swift should be opt-in: you should be able to use borrowing references in performance sensitive code, and get guarantees about (e.g.) no ARC. You should be able to opt into making a struct move-only, and thus only work with those references, etc. However, it shouldn’t be a required part of the programming model that all swift programmers need to confront to learn the language. - This is certainly out of scope for swift 3 :-( OTOH, if someone were motivated to start exploring a concrete design in the space, it would be very very interesting. One of the reasons that inout is where it is in the grammar is to allow other kinds of named parameter modifiers along the lines of Rust’s. -Chris