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

Joe Groff jgroff at apple.com
Fri Dec 18 19:46:07 CST 2015


> On Dec 18, 2015, at 5:33 PM, Dave Abrahams <dabrahams at apple.com> wrote:
> 
>> 
>> On Dec 18, 2015, at 5:30 PM, Joe Groff via swift-evolution <swift-evolution at swift.org> wrote:
>> 
>> 
>>> On Dec 18, 2015, at 5:27 PM, Matthew Johnson <matthew at anandabits.com> wrote:
>>> 
>>> +1.  Can you provide an example showing where you would place it though?
>> 
>> Good question. Three options I see:
>> 
>> - Before the label and binding names, where inout appears today, and where other argument modifiers like `@autoclosure` go: func foo(&label x: Int)
>> 
>> which is the minimal change.
>> 
>> - Before the binding name: func foo(label &x: Int)
>> 
>> which is problematic for implicitly-labeled arguments.
>> 
>> - Before the type name: func foo(label x: &Int)
>> 
>> This is the most definition-follows-use-y, but would be inconsistent with other argument modifiers.
> 
> What is your suggested term for these kinds of parameters once we retire “inout”?

I'd still call them 'inout', but I agree it's unfortunate that that wouldn't be spelled out anywhere in source.

-Joe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151218/9a6efc97/attachment.html>


More information about the swift-evolution mailing list