<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><blockquote type="cite" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>* What is your evaluation of the proposal?<br class=""></blockquote><div class=""><br class=""></div><div class="">+1</div><br class=""><blockquote type="cite" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>* Is the problem being addressed significant enough to warrant a change to Swift?<br class=""></blockquote><div class=""><br class=""></div><div class="">Its not really a problem per se, but an inconsistency, and this proposal does a very good job of addressing it</div><br class=""><blockquote type="cite" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>* Does this proposal fit well with the feel and direction of Swift?<br class=""></blockquote><div class=""><br class=""></div><div class="">Yes. One of the declared goals for Swift is to streamline the type system and remove idiosyncrasies. This proposal does exactly that</div><div class=""><br class=""></div><blockquote type="cite" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>* How much effort did you put into your review? A glance, a quick reading, or an in-depth study?<br class=""></blockquote><div class=""><br class=""></div><div class="">I was following the discussion quite closely.&nbsp;</div><div class=""><br class=""></div><div class="">— Taras</div><br class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 14 Feb 2016, at 03:08, Andrew Bennett via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><span class="im" style="font-size:13px">&gt;&nbsp; &nbsp; &nbsp; &nbsp;* What is your evaluation of the proposal?<br class=""><br class=""></span>+0.5 A good improvement. I think it could be made less special-case, but that can be built on top of this. See my next comments for more details.<br style="font-size:13px" class=""><span class="im" style="font-size:13px"><br class="">&gt;&nbsp; &nbsp; &nbsp; &nbsp;* Is the problem being addressed significant enough to warrant a change to Swift?<br class=""><br class=""></span>Not a major problem, but an incremental improvement with easy migration and no negative impact.<br style="font-size:13px" class=""><span class="im" style="font-size:13px"><br class="">&gt;&nbsp; &nbsp; &nbsp; &nbsp;* Does this proposal fit well with the feel and direction of Swift?<br class=""><br class=""></span><span style="font-size:13px" class="">Yes, although I think it needs a little more work before it's properly Swifty.</span><div class=""><span style="font-size:13px" class=""><br class=""></span></div><div class="">We are now saying it's part of the argument's type, but that type is *only* an argument type, you cannot use that type elsewhere.&nbsp;I can see this as being confusing for people unfamiliar with inout. When it's part of the label it's obvious it's only usable as an argument.</div><div class=""><br class=""></div><div class="">If we can do this:</div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px" class=""><div class=""><font face="monospace, monospace" class="">func foo(a: B)</font></div><div class=""><font face="monospace, monospace" class="">var b: B</font></div></blockquote><div class=""><br class=""></div><div class="">Why can't we do this?</div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px" class=""><div class=""><font face="monospace, monospace" class="">func foo(a: inout B)</font></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px" class=""><div class=""><font face="monospace, monospace" class="">var b: inout B</font></div></blockquote><div class=""><br class=""></div><div class="">I'd like to see a reference modifier for types that can be used elsewhere.</div><div class=""><br class=""></div><div class=""><div class="">It seems reasonable to be able to refer to the inout type outside of an argument context.</div><div class=""><div class=""><br class=""></div><div class="">I presume that this:</div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="color:rgb(187,44,162)" class="">func</span>&nbsp;test(<span style="color:rgb(187,44,162)" class="">inout</span>&nbsp;a:&nbsp;<span style="color:rgb(112,61,170)" class="">Int</span>) {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; a =&nbsp;<span style="color:rgb(39,42,216)" class="">456</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">}</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="color:rgb(187,44,162)" class="">var</span>&nbsp;a =&nbsp;<span style="color:rgb(39,42,216)" class="">123</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(49, 89, 93);" class="">test<span style="" class="">(&amp;</span><span style="color:rgb(79,129,135)" class="">a</span><span style="" class="">)</span></div></blockquote><div class=""><div class=""><br class=""></div><div class="">Is roughly equivalent to something like this:</div></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px" class=""><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="color:rgb(187,44,162)" class="">class</span>&nbsp;Reference&lt;T&gt; {</div></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp;&nbsp;<span style="color:rgb(187,44,162)" class="">var</span>&nbsp;value:&nbsp;<span style="color:rgb(112,61,170)" class="">T</span></div></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp;&nbsp;<span style="color:rgb(187,44,162)" class="">init</span>(value:&nbsp;<span style="color:rgb(112,61,170)" class="">T</span>) {&nbsp;<span style="color:rgb(187,44,162)" class="">self</span>.<span style="color:rgb(79,129,135)" class="">value</span>&nbsp;= value }</div></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">}</div></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="color:rgb(187,44,162)" class="">func</span>&nbsp;test(a:&nbsp;<span style="color:rgb(79,129,135)" class="">Reference</span>&lt;<span style="color:rgb(112,61,170)" class="">Int</span>&gt;) {</div></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; a.<span style="color:rgb(79,129,135)" class="">value</span>&nbsp;=&nbsp;<span style="color:rgb(39,42,216)" class="">456</span></div></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">}</div></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="color:rgb(187,44,162)" class="">var</span>&nbsp;b =&nbsp;<span style="color:rgb(39,42,216)" class="">123</span></div></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="color:rgb(187,44,162)" class="">var</span>&nbsp;bRef =&nbsp;<span style="color:rgb(79,129,135)" class="">Reference</span>(value:&nbsp;<span style="color:rgb(79,129,135)" class="">b</span>)</div></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(49, 89, 93);" class="">test<span style="" class="">(</span><span style="color:rgb(79,129,135)" class="">bRef</span><span style="" class="">)</span></div></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);" class="">b<span style="" class="">&nbsp;=&nbsp;</span>bRef<span style="" class="">.</span>value</div></div></blockquote><div class=""><div class=""><br class=""></div><div class="">I'd be happy if&nbsp;<b class=""><font face="monospace, monospace" class="">inout</font></b>&nbsp;it was implemented something like this, and there were optimisations introduced to ensure this was done as efficiently as inout currently is.</div></div></div></div><div class=""><span class="im" style="font-size:13px"><br class=""></span></div><div class=""><span class="im" style="font-size:13px">See </span><b class="">potential future work</b> below for details.</div><div class=""><span class="im" style="font-size:13px"><br class="">&gt;&nbsp; &nbsp; &nbsp; &nbsp;* If you have you used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?<br class=""><br class=""></span>It's roughly similar to a few other languages I've used, it seems consistent to make it about the argument's type.<br style="font-size:13px" class=""><span class="im" style="font-size:13px"><br class="">&gt;&nbsp; &nbsp; &nbsp; &nbsp;* How much effort did you put into your review? A glance, a quick reading, or an in-depth study?<br class=""><br class=""></span>I read through and considered the implications of&nbsp;making inout more explicitly part of the argument type, instead of just the function's type.<div class=""><div class=""><div class=""><div class=""><br class=""></div><div class=""><b class="">Potential future work:</b><br class=""></div><div class=""><br class=""></div><div class="">It seems to me that <b class=""><font face="monospace, monospace" class="">inout</font></b>/<b class=""><font face="monospace, monospace" class="">&amp;</font></b> are to&nbsp;<b class=""><font face="monospace, monospace" class="">?</font></b>&nbsp;what <b class=""><font face="monospace, monospace" class="">Reference&lt;T&gt;</font></b> is to <b class=""><font face="monospace, monospace" class="">Optional&lt;T&gt;</font></b>. We already have the&nbsp;<b class=""><font face="monospace, monospace" class="">indirect</font></b>&nbsp;keyword on enums, perhaps&nbsp;<b class=""><font face="monospace, monospace" class="">indirect</font>,&nbsp;</b><b class=""><font face="monospace, monospace" class="">inout</font></b>, and&nbsp;<b class=""><font face="monospace, monospace" class="">&amp;</font></b>&nbsp;should all be combined into one concept.&nbsp;</div></div></div><div class=""><br class=""></div><div class=""><font face="monospace, monospace" class="">&amp;Type</font>&nbsp;is equivalent to:</div></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px" class=""><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);" class="">Reference<span style="" class="">&lt;</span>Type<span style="" class="">&gt;</span></div></div></blockquote><font face="Menlo" class=""><span style="font-size:11px" class=""><br class=""></span></font><div class=""><div class=""><span style="font-family:Menlo;font-size:11px" class="">test(&amp;foo)</span>&nbsp;is equivalent to:</div></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="color:rgb(187,44,162)" class="">var</span> fooRef = <span style="color:rgb(79,129,135)" class="">Reference</span>(value: <span style="color:rgb(79,129,135)" class="">foo</span>)</div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);" class=""><span style="color:rgb(49,89,93)" class="">test</span><span style="" class="">(</span>fooRef<span style="" class="">)</span></div><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class="">

</p><span style="color:rgb(79,129,135);font-family:Menlo;font-size:11px" class="">foo</span><span style="font-family: Menlo; font-size: 11px;" class="">&nbsp;= </span><span style="color:rgb(79,129,135);font-family:Menlo;font-size:11px" class="">fooRef</span><span style="font-family: Menlo; font-size: 11px;" class="">.</span><span style="color:rgb(79,129,135);font-family:Menlo;font-size:11px" class="">value</span></blockquote><div class=""><div class=""><div class=""><br class=""></div><div class="">Similar to optionals you could have syntactic sugar to get and set the value, simplifying this to:</div><div class=""><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="color:rgb(187,44,162)" class="">var</span>&nbsp;fooRef =&nbsp;&amp;<span style="color:rgb(79,129,135)" class="">foo</span></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);" class=""><span style="color:rgb(49,89,93)" class="">test</span><span style="" class="">(</span>fooRef<span style="" class="">)</span></div><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""></p><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);" class="">foo<span style="" class="">&nbsp;=&nbsp;</span>fooRef</div></blockquote><font color="#4f8187" face="Menlo" class=""><span style="font-size:11px" class=""><div class=""><font color="#4f8187" face="Menlo" class=""><span style="font-size:11px" class=""><br class=""></span></font></div><div class=""><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small" class="">With an enum instead of using indirect you could use Reference&lt;T&gt;.</span><font color="#4f8187" face="Menlo" class=""><span style="font-size:11px" class=""><br class=""></span></font></div><div class=""><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small" class=""><br class=""></span></div><div class=""><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small" class=""><b class="">Potential issues:</b></span></div><br class=""></span></font>I'm not sure if it will be confusing that using&nbsp;<b class=""><font face="monospace, monospace" class="">&amp;</font></b>&nbsp;in a declaration makes a copy; using&nbsp;<b class=""><font face="monospace, monospace" class="">&amp;</font></b>&nbsp;in an argument makes a copy, then copies it back after the call. Also this could be confusing if you're used to pointers/references and expect changing foo to change the value of `fooRef`. This may be solved if foo is aliased to fooRef for the lifetime of fooRef, however that may be confusing for users that aren't used to&nbsp;pointers/references.<font color="#4f8187" face="Menlo" class=""><span style="font-size:11px" class=""><br class=""></span></font><div class=""><div class=""></div></div></div><div class=""><br class=""></div><div class="">There's also the issue of what to do if someone writes&nbsp;<span style="font-family:Menlo;font-size:11px" class="">&amp;&amp;</span><span style="font-family:Menlo;font-size:11px;color:rgb(79,129,135)" class="">foo</span>, does this make any sense as it's not really a pointer, and you cannot offset it? I think that calling &amp; on a reference type would have to be identity.</div><div class=""><br class=""></div><div class=""><b class="">Potential future-future work:</b></div><div class="">Make the distinction between struct and class stop at SIL, implement them on top of a Reference&lt;T&gt; style type (with compiler support), then use something akin to property behaviours to implement inheritance, overloading, etc.</div><div class=""><br class=""></div><div class="">Any simplifications/generalisations like this should only really be done if they don't make it harder to interpret error messages.</div><div class=""><br class=""></div><div class="">On Friday, 12 February 2016, Chris Lattner via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hello Swift community,<br class="">
<br class="">
The review of "Adjusting inout Declarations for Type Decoration" begins now and runs through February 15th. The proposal is available here:<br class="">
<br class="">
&nbsp; &nbsp; &nbsp; &nbsp; <a href="https://github.com/apple/swift-evolution/blob/master/proposals/0031-adjusting-inout-declarations.md" target="_blank" class="">https://github.com/apple/swift-evolution/blob/master/proposals/0031-adjusting-inout-declarations.md</a><br class="">
<br class="">
Reviews are an important part of the Swift evolution process. All reviews should be sent to the swift-evolution mailing list at<br class="">
<br class="">
&nbsp; &nbsp; &nbsp; &nbsp; <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="">
<br class="">
or, if you would like to keep your feedback private, directly to the review manager.<br class="">
<br class="">
What goes into a review?<br class="">
<br class="">
The goal of the review process is to improve the proposal under review through constructive criticism and, eventually, determine the direction of Swift. When writing your review, here are some questions you might want to answer in your review:<br class="">
<br class="">
&nbsp; &nbsp; &nbsp; &nbsp; * What is your evaluation of the proposal?<br class="">
&nbsp; &nbsp; &nbsp; &nbsp; * Is the problem being addressed significant enough to warrant a change to Swift?<br class="">
&nbsp; &nbsp; &nbsp; &nbsp; * Does this proposal fit well with the feel and direction of Swift?<br class="">
&nbsp; &nbsp; &nbsp; &nbsp; * If you have you used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?<br class="">
&nbsp; &nbsp; &nbsp; &nbsp; * How much effort did you put into your review? A glance, a quick reading, or an in-depth study?<br class="">
<br class="">
More information about the Swift evolution process is available at<br class="">
<br class="">
&nbsp; &nbsp; &nbsp; &nbsp; <a href="https://github.com/apple/swift-evolution/blob/master/process.md" target="_blank" class="">https://github.com/apple/swift-evolution/blob/master/process.md</a><br class="">
<br class="">
Thank you,<br class="">
<br class="">
-Chris Lattner<br class="">
Review Manager<br class="">
_______________________________________________<br class="">
swift-evolution mailing list<br class="">
<a class="">swift-evolution@swift.org</a><br class="">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="">
</blockquote></div></div>
</div></div></div>
_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></body></html>