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

Matthew Johnson matthew at anandabits.com
Fri Dec 18 19:27:15 CST 2015


+1.  Can you provide an example showing where you would place it though?

Sent from my iPad

> On Dec 18, 2015, at 7:23 PM, Joe Groff via swift-evolution <swift-evolution at swift.org> wrote:
> 
> For Swift 3, we're planning to phase out 'var' parameters in functions, and we're also making it so that language keywords are valid argument labels. With both of these changes pending, I have a hard time not reading:
> 
> func foo(inout x: Int)
> 
> as an argument labeled `inout` instead of an unlabeled argument bound to `x`. Once `var` is phased out, `inout` would also be the only remaining case where quoting is necessary to use a name as an argument label. The `inout` keyword has always struck me as weird, since it violates definition-follows-use—maybe we should replace it with the `&` sigil, mirroring its usage in call sites.
> 
> -Joe
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151218/1039a4d2/attachment.html>


More information about the swift-evolution mailing list