<div dir="ltr">As far as I understand it, the Rust Dream™ is one day being able to pass around classes and certain other types without the overhead of ARC, thanks to compile-time borrow checking. This would be handy for resource-constrained platforms and performance critical use cases.<div><br></div><div>In order to support this sort of feature we&#39;d probably need to be able to annotate parameters to functions (like &#39;inout&#39;) to indicate e.g. whether &#39;ownership&#39; of a variable opting into this system is being transferred or not. Rust&#39;s system is described here: <a href="https://doc.rust-lang.org/book/ownership.html">https://doc.rust-lang.org/book/ownership.html</a></div><div><br></div><div>Best,</div><div>Austin</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jan 29, 2016 at 4:22 PM, Charles Kissinger via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><span class=""><blockquote type="cite"><div>On Jan 29, 2016, at 3:50 PM, Erica Sadun &lt;<a href="mailto:erica@ericasadun.com" target="_blank">erica@ericasadun.com</a>&gt; wrote:</div><br><div><div style="word-wrap:break-word"><div>The great advantages are:</div><div><br></div><div>1. It removes a potentially confusing overlap with C-style expectations. People see &amp; and think &quot;POINTERS!&quot;, which is not how things work in Swift with copy-back.</div></div></div></blockquote><div><br></div></span><div>Yes, I’ve seen the argument. I just don’t have any idea if that leads to any bad developer decisions.</div><span class=""><br><blockquote type="cite"><div><div style="word-wrap:break-word"><div>(2. It eventually frees up &amp;, so we can have more Rust)</div><div><br></div></div></div></blockquote><div><br></div></span><div>I’m just going to go ahead and assume that’s a good thing.</div><div><br></div><div>—CK</div><span class=""><br><blockquote type="cite"><div><div style="word-wrap:break-word"><div>-- E</div><div><br></div><div><blockquote type="cite"><div>On Jan 29, 2016, at 4:42 PM, Charles Kissinger &lt;<a href="mailto:crk@akkyra.com" target="_blank">crk@akkyra.com</a>&gt; wrote:</div><br><div><div style="word-wrap:break-word">Sorry, I wasn’t clear at all there. I was thinking of the most common case where there is either only one parameter or the inout parameter is the first one. Then there will typically be no argument label involved at the call site. In that case ‘inout’ will be the first word inside the parens at the call site (assuming it replaces ‘&amp;’). If it also is kept in its current position in function declarations, it will be in that same leading position in declarations and (I’m assuming) people will have an easy time remembering where to put it.<div><div><br></div><div>When there is a label involved, it is a different story. I was implicitly, and probably wrongly, assuming that would be a much less common case in practice. A poorly worded, and probably poorly reasoned, argument on my part, though I still don’t see any great advantage to replacing ‘&amp;&#39;.</div><div><br></div><div>—CK</div><div><br><div><blockquote type="cite"><div>On Jan 29, 2016, at 2:13 PM, Erica Sadun &lt;<a href="mailto:erica@ericasadun.com" target="_blank">erica@ericasadun.com</a>&gt; wrote:</div><br><div><div style="word-wrap:break-word"><br><div><blockquote type="cite"><div>On Jan 29, 2016, at 3:04 PM, Charles Kissinger &lt;<a href="mailto:crk@akkyra.com" target="_blank">crk@akkyra.com</a>&gt; wrote:</div><div><div style="word-wrap:break-word"><div>The related idea of replacing ‘&amp;’ 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.<br></div></div></div></blockquote><br></div><div>If you have a function</div><div><br></div><div><font face="Menlo">f(x: Int) {}</font></div><div><br></div><div>you call it with f(8), and potentially f(x: 8). Even when labeled, the 8 value is to the right of the colon.</div><div><br></div><div>Now consider</div><div><br></div><div><font face="Menlo">f(x: inout Int) {}</font></div><div><br></div><div>you call it with f(&amp;y) or f(inout y), and with a label, you&#39;d call it f(x: &amp;y) or f(x: inout y).</div><div><br></div><div>It seems  consistent to me.</div><br></div></div></blockquote></div><br></div></div></div></div></blockquote></div><br></div></div></blockquote></span></div><br></div><br>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br></blockquote></div><br></div>