Swift should use "inout" not "&" to pass inout parameters
| Originator: | alexisgallagher | ||
| Number: | rdar://17290322 | Date Originated: | 2014-06-12 |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | |
| Classification: | Reproducible: |
Summary:
When I define a function parameter as inout, I use the "inout" keyword.
When I pass an argument into an inout parameter, I use the sigil "&". But nothing about an ampersand suggests "inout". It feels like a misplaced C vestige.
I suggest that after defining a function with an inout parameter, like so:
func swap(inout a:Int, inout b:Int) -> () { // ... }
the most logical syntax for the functional call is like so:
swap(inout a, inout b)
Steps to Reproduce:
1. Define a function with an inout parameter
2. Call the function
Expected Results:
Use a logical syntax for function call
Actual Results:
Use a vestigial C syntax for the function call
Version:
Notes:
Configuration:
Xcode6-Beta
Attachments:
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!
Or use & on both places