<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 <div class=""><br class=""></div><div class="">func posF(x: Int) -> 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 <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> 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=""> let posC = { max(0, $0) }</div><div class=""><br class=""></div><div class="">Is legal but you have to write:</div><div class=""><br class=""></div><div class=""> func posF(x: Int) -> Int { return max(0, x) }<br class=""><br class="">On Thursday, 4 February 2016, Chris Liscio via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> 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=""> private var _wrapped: Something</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class=""> var wrappedProperty: Int {</font></div><div class=""><font face="Menlo" class=""> get { _wrapped.property }</font></div><div class=""><font face="Menlo" class=""> set { _wrapped.property = $0 }</font></div><div class=""><font face="Menlo" class=""> }</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class=""> 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=""> -- 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>