<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="">Jessy,<div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 3, 2016, at 5:08 PM, Jessy Catterwaul &lt;<a href="mailto:mr.jessy@gmail.com" class="">mr.jessy@gmail.com</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="">+1 on implicit return</div></div></div></blockquote><div><br class=""></div><div>Yay!</div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">-1 on $0; I like newValue more than it.</div></div></div></blockquote><div><br class=""></div><div>Well, my problem with newValue is the lack of consistency with everywhere else. If we’re not specifying names, then $0 feels “more like the rest of the language” than newValue does.</div><div><br class=""></div><div>If you preferred to use newValue (or any other name), you could still do:</div><div><br class=""></div><div><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><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(newValue) { _wrapped.property = newValue }</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></div></div></div></div><div><br class=""></div><div>So it wouldn’t really stomp on anything too valuable IMO.</div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">I also think the return <u class="">type</u> should be implicit.</div></div></div></blockquote><div><br class=""></div><div>An implicit return type could certainly be nice as well.</div><div><br class=""></div><div>Chris</div><div><br class=""></div><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><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=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></blockquote></div><br class=""></div></div></blockquote></div><br class=""></div></body></html>