<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="">I don’t think adding &lt;= which is really just a synonym for `return` would be inconsistent with current closure definitions.<div class=""><br class=""></div><div class="">case .Buy(leg quantity, let price) where quantity * price &gt; 10000:&nbsp;</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>let vipCommissionRate = calculateCommissionRate(…)</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>quantity * price * vipCommissionRate / 100</div><div class=""><br class=""></div><div class="">is a partial closure. &nbsp;Based on closure syntax you would be able to write it as a return or not (optional). &nbsp;If a specific team has a preference I would expect them to have something like a linter.</div><div class=""><br class=""></div><div class="">If we were consistent with closure syntax and not “case” syntax it would actually read “case …. in ….” &nbsp;but no one seemed to like it (my preference would have been “=&gt;” or “-&gt;” instead of in which would be a much clear than “in”…. but that is not an option since it is not Swift syntax).</div><div class=""><br class=""></div><div class="">I personally don’t like the keyword “return” since it just seems so…. procedural…. (i.e. dating back to call …. subroutine….. return….). &nbsp;I guess each of us has hangups around silly little things…. (let still reminds me of horrid days of having to write visual basic code).</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div><blockquote type="cite" class=""><div class="">On 2016-01-17, at 2:32:11, Paul Ossenbruggen &lt;<a href="mailto:possen@gmail.com" class="">possen@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">In reviewing the proposal and looking at the statement form:<div class=""><br class=""></div><div class=""><div class=""><div class=""><div class=""><font color="#9929bd" class="">public</font>&nbsp;<font color="#61177c" class="">enum</font>&nbsp;<font color="#0056d6" class="">Trade</font>&nbsp;{</div><div class="">&nbsp; &nbsp;&nbsp;<font color="#9929bd" class="">case</font>&nbsp;Buy(quantity: Double, price: Double)</div><div class="">&nbsp; &nbsp;&nbsp;<span style="color: rgb(153, 41, 189);" class="">case</span>&nbsp;Sell(quantity: Double, price: Double)</div><div class="">}</div><div class=""><br class=""></div><div class=""><font color="#7b219f" class="">let</font>&nbsp;commissions = trades.<font color="#61177c" class="">map</font>&nbsp;{</div><div class="">&nbsp; &nbsp;&nbsp;<span style="color: rgb(153, 41, 189);" class="">case</span>&nbsp;.Buy(<font color="#9929bd" class="">let</font>&nbsp;quantity,&nbsp;<span style="color: rgb(153, 41, 189);" class="">let</span>&nbsp;price)&nbsp;<font color="#9929bd" class="">where</font>&nbsp;quantity * price &gt; 10000:</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span style="color: rgb(153, 41, 189);" class="">let</span>&nbsp;vipCommissionRate =&nbsp;<font color="#450e59" class="">calculateCommissionRate</font>(...)</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; quantity * price * vipCommissionRate / 100</div><div class="">&nbsp; &nbsp;&nbsp;<span style="color: rgb(153, 41, 189);" class="">case</span>&nbsp;.Buy(<span style="color: rgb(153, 41, 189);" class="">let</span>&nbsp;quantity,&nbsp;<span style="color: rgb(153, 41, 189);" class="">let</span>&nbsp;price):</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span style="color: rgb(153, 41, 189);" class="">let</span>&nbsp;commissionRate =&nbsp;<font color="#450e59" class="">calculateCommissionRate</font>(...)</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; quantity * price * commissionRate / 100</div><div class="">&nbsp; &nbsp;&nbsp;<span style="color: rgb(153, 41, 189);" class="">case</span>&nbsp;.Sell(<span style="color: rgb(153, 41, 189);" class="">let</span>&nbsp;quantity,&nbsp;<span style="color: rgb(153, 41, 189);" class="">let</span>&nbsp;price)&nbsp;<span style="color: rgb(153, 41, 189);" class="">where</span>&nbsp;quantity * price &gt; 10000:</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span style="color: rgb(153, 41, 189);" class="">let</span>&nbsp;vipCommissionRate =&nbsp;<font color="#450e59" class="">calculateCommissionRate</font>(...)</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; quantity * price * vipCommissionRate / 100</div><div class="">&nbsp; &nbsp;&nbsp;<span style="color: rgb(153, 41, 189);" class="">case</span>&nbsp;.Sell(<span style="color: rgb(153, 41, 189);" class="">let</span>&nbsp;quantity,&nbsp;<span style="color: rgb(153, 41, 189);" class="">let</span>&nbsp;price):</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span style="color: rgb(153, 41, 189);" class="">let</span>&nbsp;commissionRate =&nbsp;<font color="#450e59" class="">calculateCommissionRate</font>(...)</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; quantity * price * commissionRate / 100</div><div class="">}</div></div></div><br class="Apple-interchange-newline">I feel like it needs some syntax to indicate there is a return value for each case:&nbsp;</div><div class=""><br class=""></div><div class=""><div class=""><font color="#9929bd" class="">public</font> <font color="#61177c" class="">enum</font> <font color="#0056d6" class="">Trade</font> {</div><div class="">&nbsp; &nbsp; <font color="#9929bd" class="">case</font> Buy(quantity: Double, price: Double)</div><div class="">&nbsp; &nbsp;&nbsp;<span style="color: rgb(153, 41, 189);" class="">case</span>&nbsp;Sell(quantity: Double, price: Double)</div><div class="">}</div><div class=""><br class=""></div><div class=""><font color="#7b219f" class="">let</font> commissions = trades.<font color="#61177c" class="">map</font> {</div><div class="">&nbsp; &nbsp;&nbsp;<span style="color: rgb(153, 41, 189);" class="">case</span>&nbsp;.Buy(<font color="#9929bd" class="">let</font>&nbsp;quantity,&nbsp;<span style="color: rgb(153, 41, 189);" class="">let</span>&nbsp;price) <font color="#9929bd" class="">where</font> quantity * price &gt; 10000:</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span style="color: rgb(153, 41, 189);" class="">let</span>&nbsp;vipCommissionRate = <font color="#450e59" class="">calculateCommissionRate</font>(...)</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &lt;= quantity * price * vipCommissionRate / 100</div><div class="">&nbsp; &nbsp;&nbsp;<span style="color: rgb(153, 41, 189);" class="">case</span>&nbsp;.Buy(<span style="color: rgb(153, 41, 189);" class="">let</span>&nbsp;quantity,&nbsp;<span style="color: rgb(153, 41, 189);" class="">let</span>&nbsp;price):</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span style="color: rgb(153, 41, 189);" class="">let</span>&nbsp;commissionRate = <font color="#450e59" class="">calculateCommissionRate</font>(...)</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &lt;= quantity * price * commissionRate / 100</div><div class="">&nbsp; &nbsp;&nbsp;<span style="color: rgb(153, 41, 189);" class="">case</span>&nbsp;.Sell(<span style="color: rgb(153, 41, 189);" class="">let</span>&nbsp;quantity,&nbsp;<span style="color: rgb(153, 41, 189);" class="">let</span>&nbsp;price)&nbsp;<span style="color: rgb(153, 41, 189);" class="">where</span>&nbsp;quantity * price &gt; 10000:</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span style="color: rgb(153, 41, 189);" class="">let</span>&nbsp;vipCommissionRate = <font color="#450e59" class="">calculateCommissionRate</font>(...)</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &lt;= quantity * price * vipCommissionRate / 100</div><div class="">&nbsp; &nbsp;&nbsp;<span style="color: rgb(153, 41, 189);" class="">case</span>&nbsp;.Sell(<span style="color: rgb(153, 41, 189);" class="">let</span>&nbsp;quantity,&nbsp;<span style="color: rgb(153, 41, 189);" class="">let</span>&nbsp;price):</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span style="color: rgb(153, 41, 189);" class="">let</span>&nbsp;commissionRate = <font color="#450e59" class="">calculateCommissionRate</font>(...)</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &lt;= quantity * price * commissionRate / 100</div><div class="">}</div></div><div class=""><br class=""></div><div class="">it would enforce that there is only one &lt;= for each and check that each result is the correct type to prevent errors where multiple return values are generated but the last one is ignored, I suppose that could be a warning though. This would only be used in the “case” form where multiple statements are used. Another option but we loose conciseness is to require return for multi statement expressions, but if you are doing multi statement, then you are probably not as concerned about conciseness:</div><div class=""><br class=""></div><div class=""><div class=""><font color="#9929bd" class="">public</font>&nbsp;<font color="#61177c" class="">enum</font>&nbsp;<font color="#0056d6" class="">Trade</font>&nbsp;{</div><div class="">&nbsp; &nbsp;&nbsp;<font color="#9929bd" class="">case</font>&nbsp;Buy(quantity: Double, price: Double)</div><div class="">&nbsp; &nbsp;&nbsp;<span style="color: rgb(153, 41, 189);" class="">case</span>&nbsp;Sell(quantity: Double, price: Double)</div><div class="">}</div><div class=""><br class=""></div><div class=""><font color="#7b219f" class="">let</font>&nbsp;commissions = trades.<font color="#61177c" class="">map</font>&nbsp;{</div><div class="">&nbsp; &nbsp;&nbsp;<span style="color: rgb(153, 41, 189);" class="">case</span>&nbsp;.Buy(<font color="#9929bd" class="">let</font>&nbsp;quantity,&nbsp;<span style="color: rgb(153, 41, 189);" class="">let</span>&nbsp;price)&nbsp;<font color="#9929bd" class="">where</font>&nbsp;quantity * price &gt; 10000:</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span style="color: rgb(153, 41, 189);" class="">let</span>&nbsp;vipCommissionRate =&nbsp;<font color="#450e59" class="">calculateCommissionRate</font>(...)</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; <font color="#9929bd" class="">return</font> quantity * price * vipCommissionRate / 100</div><div class="">&nbsp; &nbsp;&nbsp;<span style="color: rgb(153, 41, 189);" class="">case</span>&nbsp;.Buy(<span style="color: rgb(153, 41, 189);" class="">let</span>&nbsp;quantity,&nbsp;<span style="color: rgb(153, 41, 189);" class="">let</span>&nbsp;price):</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span style="color: rgb(153, 41, 189);" class="">let</span>&nbsp;commissionRate =&nbsp;<font color="#450e59" class="">calculateCommissionRate</font>(...)</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span style="color: rgb(153, 41, 189);" class="">return</span>&nbsp;quantity * price * commissionRate / 100</div><div class="">&nbsp; &nbsp;&nbsp;<span style="color: rgb(153, 41, 189);" class="">case</span>&nbsp;.Sell(<span style="color: rgb(153, 41, 189);" class="">let</span>&nbsp;quantity,&nbsp;<span style="color: rgb(153, 41, 189);" class="">let</span>&nbsp;price)&nbsp;<span style="color: rgb(153, 41, 189);" class="">where</span>&nbsp;quantity * price &gt; 10000:</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span style="color: rgb(153, 41, 189);" class="">let</span>&nbsp;vipCommissionRate =&nbsp;<font color="#450e59" class="">calculateCommissionRate</font>(...)</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span style="color: rgb(153, 41, 189);" class="">return</span>&nbsp;quantity * price * vipCommissionRate / 100</div><div class="">&nbsp; &nbsp;&nbsp;<span style="color: rgb(153, 41, 189);" class="">case</span>&nbsp;.Sell(<span style="color: rgb(153, 41, 189);" class="">let</span>&nbsp;quantity,&nbsp;<span style="color: rgb(153, 41, 189);" class="">let</span>&nbsp;price):</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span style="color: rgb(153, 41, 189);" class="">let</span>&nbsp;commissionRate =&nbsp;<font color="#450e59" class="">calculateCommissionRate</font>(...)</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span style="color: rgb(153, 41, 189);" class="">return</span>&nbsp;quantity * price * commissionRate / 100</div><div class="">}</div></div><div class=""><br class=""></div><div class=""><br class=""></div></div></div></blockquote></div><br class=""></div></body></html>