[swift-evolution] [Pitch] Replace 'inout' with '&'

Chris Lattner clattner at apple.com
Mon Dec 21 13:51:03 CST 2015

> On Dec 21, 2015, at 10:52 AM, Joe Groff <jgroff at apple.com> wrote:
>> -1
>> “inout” is intended to communicate (or at least hint at) the copy-in / copy-out behavior of the argument.  It is also there to enable other parameter modifiers, which can enable other more advanced parameters models in the future (e.g. rust-style borrowing).
> If we added those kinds of knobs, they'd almost certainly be @attributes IMO. A borrow model isn't really a core interface change the way `inout` is; it's a set of additional restrictions on use that let the compiler avoid unwanted retaining and copying.

It depends on the details of the design.  If something is currently borrowed “mut” then it can’t be used by anyone else. I’d want that “borrowing” action to be explicit in the code.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151221/4041b8e5/attachment.html>

More information about the swift-evolution mailing list