[swift-evolution] [Proposal] Adjusting `inout` Declarations for Type Decoration

Erica Sadun erica at ericasadun.com
Fri Jan 29 16:13:08 CST 2016


> On Jan 29, 2016, at 3:04 PM, Charles Kissinger <crk at akkyra.com> wrote:
> The related idea of replacing ‘&’ with ‘inout’ at the call site seems completely contradictory to this proposal. Developers would then have to remember that the ‘inout’ goes before the argument at the call site but after it in the function definition. That seems like a constant source of mis-typings and something that would be viewed as an inconsistency in the language. Or do people want to put it after the argument name at the call site too? It seems a little like change just for the sake of change, IMO.

If you have a function

f(x: Int) {}

you call it with f(8), and potentially f(x: 8). Even when labeled, the 8 value is to the right of the colon.

Now consider

f(x: inout Int) {}

you call it with f(&y) or f(inout y), and with a label, you'd call it f(x: &y) or f(x: inout y).

It seems  consistent to me.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160129/6cffa34b/attachment.html>


More information about the swift-evolution mailing list