<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><br><div>On 7 Oct 2017, at 19:22, Tony Allevato via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr">I think the important thing to consider is, what advantage would such a feature provide *other* than to reduce keystrokes? (I don't personally think that optimizing for keys pressed by itself should be a goal.)<div><br></div><div>In the case of closures, single expression closures without "return" improve readability because such closures are often chained for functional programming patterns:</div><div><br></div><div> someArray.filter { $0.isFloopy }.map { $0.grobber }</div><div><br></div><div>Having "return" there would be noise that detracts from understanding what's going on in that algorithm. It's also worth noting that in this context, the closure *itself* is also an expression.</div><div><br></div><div>In functions, property getters, and subscripts, the same constraints don't really hold. They're declarations, not expressions, so they don't chain together and they're not subject to the same readability problems as closure expressions.</div></div></div></blockquote><div><br></div><div>Agreed. I would be wary because consistency would push us to allow it in functions also and I’m not sure it makes as much sense there.</div><br><blockquote type="cite"><div><div class="gmail_quote"><div dir="ltr">On Sat, Oct 7, 2017 at 9:59 AM Nevin Brackett-Rozinsky via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sat, Oct 7, 2017 at 11:24 AM, Xiaodi Wu <span dir="ltr"><<a href="mailto:xiaodi.wu@gmail.com" target="_blank">xiaodi.wu@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This has been brought up on the list before. For instance:<br><br><a href="https://github.com/apple/swift-evolution/pull/608" target="_blank">https://github.com/apple/swift-evolution/pull/608</a><br><br>Chris Lattner’s response at that time was:<br><br>‘Just MHO, but I consider this syntactic sugar, not a fundamental feature that fits the goal of Swift 4 stage 2. <br><br>‘I’m also pretty opposed to doing it at any time. The rationale of “implicit return” in closures is specifically because they are limited to a single expression, which makes the semantics “obvious”. This was carefully considered.’</blockquote><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>This objection is not applicable, because we are discussing the possibility to omit “return” exactly when there is a single expression in the getter.</div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div>Nevin</div></div></div></div>
_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">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>
</blockquote></div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></body></html>