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

Slava Pestov spestov at apple.com
Fri Dec 18 20:16:24 CST 2015


> 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.

It seems the latter is the only one of the three that would also make sense for function types. We still need to be able to write down a function type containing an inout parameter right?

Also your ideas for lenses involved inout return types — how would these fit in?

> 
> -Joe
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution



More information about the swift-evolution mailing list