<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="">Just food for thought: C# has a special syntax, inspired by its own lambda syntax, for single-expression functions:<div class=""><br class=""></div><div class=""><div class=""></div></div><blockquote type="cite" class=""><div class=""><div class="">// lambda syntax</div><div class="">param =&gt; param + 4</div><div class=""><br class=""></div><div class="">// single-expression method syntax</div><div class="">int AddFour(int param) =&gt; param + 4;</div></div></blockquote><div class=""><br class=""></div><div class="">Swift's syntax for declaring functions and lambdas are harder to link like that though.</div><div class=""><br class=""><div class="">
<span class="Apple-style-span" style="border-collapse: separate; line-height: normal; border-spacing: 0px;">Félix</span>
</div>

<br class=""><div><blockquote type="cite" class=""><div class="">Le 19 déc. 2015 à 23:26:49, Jordan Rose via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; a écrit :</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">I'm not going to go as far as a definitive +1, but I've definitely wanted this for var and subscript getters. If it were limited to single-expression functions, I don't see much harm. The only time there'd be a problem is if the return types matched <i class="">and</i>&nbsp;you were going to have another statement instead.</div><div class=""><br class=""></div><div class="">It feels weird for anything imperative, but I think the whole point is that there are plenty of functions which do absolutely no imperative work. I personally wouldn't want people to start using it for forwarding imperative things, though.</div><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class="">func sendHTTPRequest() -&gt; Result {</div><div class="">&nbsp; sendHTTPRequestImpl(destinationURL, body)</div><div class="">}</div></blockquote><div class=""><br class=""></div><div class="">Jordan</div><div class=""><br class=""></div><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Dec 19, 2015, at 5:30 , Craig Cruden 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=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><br class=""></div><div class="">When writing short functional code in a function it would be nice if the return keyword were an optional keyword.&nbsp;</div><div class=""><br class=""></div><div class="">Just return the last evaluated expression.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">i.e.</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp;&nbsp;<span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">func</span> flipFunc&lt;T, U&gt;(arg1: <span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">T</span>, arg2: <span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">U</span>) -&gt; (<span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">U</span>, <span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">T</span>) {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; &nbsp; &nbsp; (arg2, arg1)</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; }</div></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class="">The keyword return would still be there for breaking out of a function.</div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=ZEz4qHYnXhPr3bBPu-2FxP4tN3HfWKL-2FtJpqkQ0gkOVSBOoeFpYD98joqJQUtm1UfhaoB3a1f2V-2FdeoXwmglho9LQ1qV-2F-2FwMe5f-2BI-2Bn6ktiSkNKEFuFkxXVffXRAbF0xXAqwqS8iXHmtFwbni5UnJlhWTfP87yn7m1JX9URVl9myv58TicRT7m7kGdVFjeJ2S89u9hsc9iTez0usRDUlbjYhwgjkaRJ6UNttPRlG0ZC8I-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;" class="">
</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="">
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=iRI3beHTe3UxYAHTlV3lA38zIPfHMhyuRzgTmGKV6k7H9G0exBpnFnuN59c3-2FZ7QZwJQGbSu87a1-2BdRJ-2Bhj529bfdAiXpdO8Hv8GXBwiySOCxBu4w8ubcCSnZfM4OxSQzcy8esuk3-2BIeUCAG5bNv8lkC-2FyF8T-2FeAOkrK79-2BeJNEDyRXfYBxoYnnCiyN65B13QZjcsSMv4UyyyXAZsLh0bWEsjD338krEn87iiVQ-2F-2FJE-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;" class="">
</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=""></div></body></html>