<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="">I consider&nbsp;<div class=""><br class=""></div><div class="">func posF(x: Int) -&gt; Int { return max(0, x) }<div class=""><br class=""></div><div class="">to be a precursor to the syntax we’ll eventually have:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">func</span> posF(Int) {max(<span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">0</span>, $0)}</div></div><div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 3, 2016, at 5:29 PM, Howard Lovatt 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="">You can keep going on this line of thinking, e.g.:<div class=""><br class=""></div><div class="">&nbsp; &nbsp;&nbsp;let posC&nbsp;= { max(0,&nbsp;$0)&nbsp;}</div><div class=""><br class=""></div><div class="">Is legal but you have to write:</div><div class=""><br class=""></div><div class="">&nbsp; &nbsp; func posF(x: Int) -&gt; Int { return max(0, x) }<br class=""><br class="">On Thursday, 4 February 2016, Chris Liscio via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class="">Why can’t we use shorthand argument names and implicit returns when specifying the get and set blocks in a computed property? I.e., Why must we refer to newValue in the implementation of set, and not $0 like we do in closures? Also, why do we need ‘return’?</div><div class=""><br class=""></div><div class="">Once you get used to the shorthand, you kinda want to use it all over…</div><div class=""><br class=""></div><div class="">This question came up recently when I was writing a façade for another class, and would have liked to written something like the following:</div><div class=""><br class=""></div><div class=""><font face="Menlo" class="">class Façade {</font></div><div class=""><font face="Menlo" class="">&nbsp; private var _wrapped: Something</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class="">&nbsp; var wrappedProperty: Int {</font></div><div class=""><font face="Menlo" class="">&nbsp; &nbsp; get { _wrapped.property }</font></div><div class=""><font face="Menlo" class="">&nbsp; &nbsp; set { _wrapped.property = $0 }</font></div><div class=""><font face="Menlo" class="">&nbsp; }</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class="">&nbsp; var multipliedProperty: Int { _wrapped.property * 42 }</font></div><div class=""><font face="Menlo" class="">}</font></div><div class=""><br class=""></div>I apologize if this has already been discussed/requested before. I searched the archives and didn’t turn up anything that referred to this specifically.<div class=""><br class=""></div><div class="">Thanks!</div><div class=""><br class=""></div><div class=""><div class="">Chris Liscio</div><div class=""><a href="http://supermegaultragroovy.com/" target="_blank" class="">http://supermegaultragroovy.com</a></div><div class="">Learn _your_ music with Capo: <a href="http://capoapp.com/" target="_blank" class="">http://capoapp.com</a></div></div><div class=""><br class=""></div></div></blockquote></div><br class=""><br class="">-- <br class="">&nbsp; -- Howard.<br class=""><br class="">
_______________________________________________<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=""></div></div></body></html>