<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Jul 23, 2015 at 2:00 PM, Adam D. Ruppe via Digitalmars-d <span dir="ltr"><<a href="mailto:digitalmars-d@puremagic.com" target="_blank">digitalmars-d@puremagic.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">I think it is actually kinda pretty:</blockquote><div><br></div><div>What about:</div><div><br></div><div><div>int median(int a, int b, int c) {</div><div>    return (a<b) ? (b<c) ? b : (a<c) ? c : a : (a<c) ? a : (b<c) ? c : b;</div><div>}</div></div><div><br></div><div>vs.</div><div><br></div><div>def median(a: Int, b: Int, c: Int) =</div><div>  if (a < b) {</div><div>    if (b < c) b</div><div>    else if (a < c) c</div><div>    else a</div><div>  }</div><div>  else if (a < c) a</div><div>  else if (b < c) c<br></div><div>  else b</div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Before you get too worried about the (), I'd point out that this is a very common pattern in Javascript (for like everything...) and while everybody hates JS, most every uses it too; this patten is good enough for usefulness.<br></blockquote><div><br></div><div>Is the compiler always able to always optimize out the function call by inlining it, as would be the case with a scope?</div><div><br></div></div></div></div>