Hacker News new | past | comments | ask | show | jobs | submit login

Agreed. It strikes me as an inelegant abuse of notation even when it's used in a maths context, albeit a convenient one. It violates the way we can usually reason about infix operators.

a < b is an expression which gives you a booean value, true or false. Why then are we comparing whether it is less than, or greater than, some number?

Unlike with addition or multiplication:

a < b < c(a < b) < c

also:

a < b < ca < (b < c)

instead:

a < b < c = ((a < b) ^ (b < c))

The same criticism does not apply to C's chained assignment expressions, a = b = c, but I dislike that for another reason: if the type of b is a narrower type than that of c, you may get an unexpected value assigned to a.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: