Just to illustrate, e.g. for:

`slow(big(10000000)) < 1 < 0`

1 < 0 could have been evaluated to false first (fast, also for variables). In fact it’s allowed by semantics.** [Then this code could have been dead-code eliminated, since in this case I used constants to show it.]

The current implementation of Julia evaluates left-to-right (here). It’s allowed NOT to, see docs (meant for a future implementation, it seems):

“However, the order of evaluations in a chained comparison is undefined. It is strongly recommended not to use expressions with side effects (such as printing) in chained comparisons. If side effects are required, the short-circuit && operator should be used explicitly”

In other words e.g.:

a(x) < b < c(y)

is not the same as:

a(x) < b && b < c(y)

and I would in fact want the same flexibility in the absence of the syntactic sugar for “comparison chaining”, by doing:

a(x) < b and b < c(y)

where `and`

doesn’t have to mean &&. If strict left-to right is desired, when you optimize, you could always substitute && for `and`

.

** I’m assuming this doesn’t have side-effects (e.g. I found a way to make such function):

```
function slow(n)
a=0
for i in 1:n
a=a*i
end
return a
end
```