<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body><div>I agree 100% with everything Jordan said.<br></div>
<div> </div>
<div>-Kevin Ballard</div>
<div> </div>
<div>On Sat, Dec 19, 2015, at 07:06 PM, Jordan Rose via swift-evolution wrote:<br></div>
<blockquote type="cite"><div>-1 to using '&' in the declaration; it's a sigil that doesn't mean anything as is. (I was originally on the side of using 'inout' at the call site as well, i.e. "swap(inout x, inout y)", but it was considered too verbose.)<br></div>
<div> </div>
<div>I don't like it as an attribute because attributes generally don't affect the <i>syntax</i> of how something is used; they're mostly just implementation detail. Obviously they can have important semantics (like "@objc(…)" controlling the selector, or '@convention(c)' for C-compatible function pointers), but for the most part they don't change what the declaration is, whereas 'inout' <i>definitely</i> does.<br></div>
<div> </div>
<div><div>Given that we already use this syntax for function types when the parameter is unnamed, '(inout Int, inout named: Int) -> Void', I think Erica's first suggestion is my favorite so far.<br></div>
</div>
<div> </div>
<div>Jordan<br></div>
<div> </div>
<div> </div>
<div><blockquote type="cite"><div>On Dec 19, 2015, at 16:10 , Erica Sadun via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br></div>
<div> </div>
<div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:auto;word-spacing:0px;-webkit-text-stroke-width:0px;">What would the ramifications of the following be? Each addresses the "confusable with labeling" issue but preserve the inout keyword.<br></div>
<div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:auto;word-spacing:0px;-webkit-text-stroke-width:0px;"> </div>
<div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:auto;word-spacing:0px;-webkit-text-stroke-width:0px;"><span class="font" style="font-family:Courier">func foo(x: inout Int)</span><br></div>
<div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:auto;word-spacing:0px;-webkit-text-stroke-width:0px;"><span class="font" style="font-family:Courier">func foo(x: @inout(Int))</span><br></div>
<div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:auto;word-spacing:0px;-webkit-text-stroke-width:0px;"><span class="font" style="font-family:Courier">func foo(x: @inout Int)</span><br></div>
<div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:auto;word-spacing:0px;-webkit-text-stroke-width:0px;"> </div>
<div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:auto;word-spacing:0px;-webkit-text-stroke-width:0px;">Is there an underlying reason that parameter modification should live on the name side rather than the type side of the colon? They aren't really modifying the name<br></div>
<div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:auto;word-spacing:0px;-webkit-text-stroke-width:0px;"> </div>
<div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:auto;word-spacing:0px;-webkit-text-stroke-width:0px;">-- Erica, inexperienced with Rust<br></div>
<div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:auto;word-spacing:0px;-webkit-text-stroke-width:0px;"> </div>
<div> </div>
<div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:auto;word-spacing:0px;-webkit-text-stroke-width:0px;"><blockquote type="cite"><div>On Dec 18, 2015, at 7:07 PM, Chris Lattner via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br></div>
<div> </div>
<div><div style="word-wrap:break-word;-webkit-line-break:after-white-space;"><div> </div>
<div><blockquote type="cite"><div>On Dec 18, 2015, at 5:23 PM, Joe Groff via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br></div>
<div> </div>
<div><div style="word-wrap:break-word;-webkit-line-break:after-white-space;"><div>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:<br></div>
<div> </div>
<blockquote style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:40px;border-top-style:none;border-right-style:none;border-bottom-style:none;border-left-style:none;border-top-width:initial;border-right-width:initial;border-bottom-width:initial;border-left-width:initial;border-top-color:initial;border-right-color:initial;border-bottom-color:initial;border-left-color:initial;border-image-source:initial;border-image-slice:initial;border-image-width:initial;border-image-outset:initial;border-image-repeat:initial;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;"><div>func foo(inout x: Int)<br></div>
<div> </div>
</blockquote><div>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.<br></div>
</div>
</div>
</blockquote><div> </div>
</div>
<div>-1<br></div>
<div> </div>
<div>“inout” is intended to communicate (or at least hint at) the copy-in / copy-out behavior of the argument. It is also there to enable other parameter modifiers, which can enable other more advanced parameters models in the future (e.g. rust-style borrowing).<br></div>
<div> </div>
<div>-Chris<br></div>
<div> </div>
<div><img style="height:1px !important;width:1px !important;border-top-width:0px !important;border-right-width:0px !important;border-bottom-width:0px !important;border-left-width:0px !important;margin-top:0px !important;margin-right:0px !important;margin-bottom:0px !important;margin-left:0px !important;padding-top:0px !important;padding-right:0px !important;padding-bottom:0px !important;padding-left:0px !important;" border="0" height="1" width="1" alt="" src="https://www.fastmailusercontent.com/proxy/f4d5c898e9e5ba81d35c777eb000505e986b13eb32565adb4ca61207d7425ca2/8647470737a3f2f25723030323431303e23647e23756e64676279646e2e65647f27766f2f60756e6f35707e6d32753a607b4379663e6164773f6164333c60734c49653742574d623574744b6264437365764b6c685a5236617d6639574958686070785635626e4874777f6e4c4a676d69444539673e6f453f673f68314a45343442465939317d636c664735594b445661603f493d22324971467d223248413c4342653d6474324a696254403538695059723e6e4076396d2236454d4d6769385d22324839535a79707567507b6f6d2236453a5433703d6d62466033516a626d634954675c62354d615569793d22364d2236474c41324534725347783975663f41766669356562614732796f6967636256643739495667493b423b403577434f425d435e6d495d23344/open"><br></div>
</div>
<div>_______________________________________________<br></div>
<div>swift-evolution mailing list<br></div>
<div><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br></div>
<div><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></div>
</div>
</blockquote></div>
<div> </div>
<div><img style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:auto;word-spacing:0px;-webkit-text-stroke-width:0px;height:1px !important;width:1px !important;border-top-width:0px !important;border-right-width:0px !important;border-bottom-width:0px !important;border-left-width:0px !important;margin-top:0px !important;margin-right:0px !important;margin-bottom:0px !important;margin-left:0px !important;padding-top:0px !important;padding-right:0px !important;padding-bottom:0px !important;padding-left:0px !important;" border="0" height="1" width="1" alt="" src="https://www.fastmailusercontent.com/proxy/8e4d9cc7a8fa8937de7d5e29d98fc030661c43a3bb04f923b15d69335eeb641f/8647470737a3f2f25723030323431303e23647e23756e64676279646e2e65647f27766f2f60756e6f35707e6d3a554a743178495e6858605273326240557d2236487054347e433846675b4c4d2236447a40717b6150376b6f4653534d6d223644454a566a724e6a597b4e435b48653b694253513f6c687e69405d223649564454795465573749705a5774417b643c6a726d2236405850307e60547735354965717354646863734b407d223241707c445b646679607a4f496862684d465d2232444c463971517053757762366d4530357e67766557614535485454636e6845617548443f6a757c6d2236497b4a7074675c6d61725d6747623839433f6436334a687639565164686841523355395870754a4a5f6c6554703472475953786838707f476d476f4975595d23344/open"><span class="font" style="font-family:Helvetica"><span class="size" style="font-size:12px"><span></span>_______________________________________________</span></span><br></div>
<div><span class="font" style="font-family:Helvetica"><span class="size" style="font-size:12px">swift-evolution mailing list</span></span><br></div>
<div><a style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:auto;word-spacing:0px;-webkit-text-stroke-width:0px;" href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br></div>
<div><a style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:auto;word-spacing:0px;-webkit-text-stroke-width:0px;" href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></div>
</div>
</blockquote></div>
<div> </div>
<div> <img style="height:1px !important;width:1px !important;border-top-width:0px !important;border-right-width:0px !important;border-bottom-width:0px !important;border-left-width:0px !important;margin-top:0px !important;margin-bottom:0px !important;margin-right:0px !important;margin-left:0px !important;padding-top:0px !important;padding-bottom:0px !important;padding-right:0px !important;padding-left:0px !important;" border="0" height="1" width="1" alt="" src="https://www.fastmailusercontent.com/proxy/815562e2db94975aa6ee8bbd6b56c6c561a17e93a8ca73e655bbcf49be027c12/8647470737a3f2f25723030323431303e23647e23756e64676279646e2e65647f27766f2f60756e6f35707e6d3148765176786c673171614a7d2236454230345272776e475948705a6c445d2236483533323034673d22324960516a7544397e6a737e61385a7762366b6b45437430397d223247474463795d6b64793d2232445147527b4a7d417a434d65667464654a73584e456d2236447e47553d6f4666745e4239497875334b6d223644385935644d4b6b62736f66396f496a625b43643c40596c6b6a66775357707a5732757174573273595d4962546640327a5d4d4843557766675a7645347d667a5c4c41786c6f65455766584d2232464d22324875543d223644365a495b666a7838745d2236405d697742677275415d23344d23344/open"><br></div>
<div><u>_______________________________________________</u><br></div>
<div>swift-evolution mailing list<br></div>
<div><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br></div>
<div><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></div>
</blockquote><div> </div>
</body>
</html>