<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=""><div class="">+1 on implicit return</div><div class="">-1 on $0; I like newValue more than it.</div><div class=""><br class=""></div><div class="">I also think the return <u class="">type</u> should be implicit.</div><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 3, 2016, at 5:00 PM, Chris Liscio 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=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" 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/" class="">http://supermegaultragroovy.com</a></div><div class="">Learn _your_ music with Capo: <a href="http://capoapp.com/" class="">http://capoapp.com</a></div></div><div class=""><br class=""></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>