[swift-evolution] [Pitch] Replace 'inout' with '&'
jgroff at apple.com
Mon Dec 21 12:34:02 CST 2015
> On Dec 18, 2015, at 6:52 PM, Dmitri Gribenko <gribozavr at gmail.com> wrote:
> On Fri, Dec 18, 2015 at 6:21 PM, Joe Groff <jgroff at apple.com> wrote:
>> On Dec 18, 2015, at 6:08 PM, Dmitri Gribenko <gribozavr at gmail.com> wrote:
>> There's also a possibility that we add 'out' parameters in the future, and
>> if 'inout' would be spelled '&', then we would need to find another sigil
>> for 'out'.
>> We have multiple returns. Why would we ever add out parameters?
> I don't want to turn this thread into a discussion about out
> parameters, but one reason would be to replace
IMO we should eventually import out params from C as multiple returns.
> Another one is to add labels to
> the output parameters:
> let (day, month, year) = parseDate()
> let (year, day, month) = parseDate() // bug?
Labeled tuples seem like they could help with that, with compiler QoI to catch cases like this where you obviously permuted the return names.
More information about the swift-evolution