<div dir="ltr">Great points Kevin, that&#39;s pretty much my thinking as well. If we&#39;re heading towards everything being an expression then it&#39;ll happen, perhaps that change shouldn&#39;t be incremental as you&#39;ve suggested, I&#39;m not sure.<div><br></div><div>The only time I&#39;ve found I&#39;ve naturally wanted to do this is with things like property definitions:</div><div><br></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="color:rgb(187,44,162)">var</span> twiceSomething: <span style="color:rgb(112,61,170)">Int</span> { <span style="color:rgb(187,44,162)">self</span>.something * <span style="color:rgb(39,42,216)">2</span> }</p></blockquote><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Dec 20, 2015 at 1:55 PM, Kevin Ballard via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>




<div><div>If Swift ever changes to be Rust-like and have every statement actually be an expression with a non-void type (I believe this was discussed in the thread about replacing ?:), then your proposed behavior is already an implicit part of that change.<br></div>
<div> </div>
<div>But barring a large change like that, I&#39;m against dropping the `return` here, as it&#39;s inconsistent with the rest of the language. The only construct today that lets you drop the return is a one-line closure, but that&#39;s already something that looks like an expression (`foo.map({ $0.x })` looks perfectly fine; `foo.map({ return $0.x })` is just unnecessary syntax). But the last statement of a function isn&#39;t an expression, it&#39;s a statement.<br></div>
<div> </div>
<div>-Kevin Ballard</div><div><div class="h5">
<div> </div>
<div>On Sat, Dec 19, 2015, at 05:30 AM, Craig Cruden via swift-evolution wrote:<br></div>
</div></div><blockquote type="cite"><div><div class="h5"><div> </div>
<div>When writing short functional code in a function it would be nice if the return keyword were an optional keyword. <br></div>
<div> </div>
<div>Just return the last evaluated expression.<br></div>
<div> </div>
<div> </div>
<div>i.e.<br></div>
<div> </div>
<div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="color:rgb(187,44,162)">func</span> flipFunc&lt;T, U&gt;(arg1: <span style="color:rgb(112,61,170)">T</span>, arg2: <span style="color:rgb(112,61,170)">U</span>) -&gt; (<span style="color:rgb(112,61,170)">U</span>, <span style="color:rgb(112,61,170)">T</span>) {<br></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:11px;line-height:normal;font-family:Menlo">        (arg2, arg1)<br></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:11px;line-height:normal;font-family:Menlo">    }<br></div>
</div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:11px;line-height:normal;font-family:Menlo"> </div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:11px;line-height:normal;font-family:Menlo"> </div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;line-height:normal">The keyword return would still be there for breaking out of a function.<br></div>
<div><img style="min-height:1px!important;width:1px!important;border-top-width:0px!important;border-right-width:0px!important;border-bottom-width:0px!important;border-left-width:0px!important;margin-top:0px!important;margin-bottom:0px!important;margin-right:0px!important;margin-left:0px!important;padding-top:0px!important;padding-bottom:0px!important;padding-right:0px!important;padding-left:0px!important" border="0" height="1" width="1" alt="" src="https://www.fastmailusercontent.com/proxy/10638ee155501fadccbd20f0d27bd9893dc169bf066f71735c7fe9b0485030a1/8647470737a3f2f25723030323431303e23647e23756e64676279646e2e65647f27766f2f60756e6f35707e6d3148765176786c673171614a7d2236454230345272776e465a59677d686c623059465037627d22324967774033575a7c46716153597e446579445b48503a7c4364415672416a453c4377484d443559677464695358457036516a4a75563850366657336947374777486d6268454378683f635e41437751734f49673c4a4e6642436076397f494a6054584d22364d223649513935536879517b44453178797135335172455a4a6968345e48505e684d2236427243363d22364876464e6c45567c49637f483d44585f4b4e483252305658714f6571737869623865533748756a5d67314d23344d23344/open"><br></div>
</div></div><span class=""><div><u>_______________________________________________</u><br></div>
<div>swift-evolution mailing list<br></div>
<div><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br></div>
<div><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></div>
</span></blockquote><div> </div>

<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=pQw7h83fWt3LLbgkfL4TSUL0weaZnVFZxDe5GShw4uRSmyHquQx-2Blgox9DhAyc5s5zygqHLTt6129wPTCH02rfb49iNutPCetk318LH2dCGP0eLzItQ7pMjZnBy4q3oqABaQO0xPlInAYJUYOI1aUOSPoc4FVz-2BGRuCbN4PvTR4Dj8JNAfdZ9Cw7LB1BQl4LC7T-2FhbtQkIBegevQK8p-2FzAfCr0d7rNivAtekNOeilzs-3D" alt="" width="1" height="1" border="0" style="min-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">
</div>


<br>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">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>
<br></blockquote></div><br></div>