On Thu, Jul 23, 2015 at 2:00 PM, Adam D. Ruppe via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
I think it is actually kinda pretty:

What about:

int median(int a, int b, int c) {
    return (a<b) ? (b<c) ? b : (a<c) ? c : a : (a<c) ? a : (b<c) ? c : b;
}

vs.

def median(a: Int, b: Int, c: Int) =
  if (a < b) {
    if (b < c) b
    else if (a < c) c
    else a
  }
  else if (a < c) a
  else if (b < c) c
  else b


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.

Is the compiler always able to always optimize out the function call by inlining it, as would be the case with a scope?