Language support for chained comparison operators (x < y < z)

Solution 1:

It should be more common, but I suspect it is not because it makes parsing languages more complex.

Benefits:

  • Upholds the principle of least surprise
  • Reads like math is taught
  • Reduces cognitive load (see previous 2 points)

Drawbacks:

  • Grammar is more complex for the language
  • Special case syntactic sugar

As to why not, my guesses are:

  • Language author(s) didn't think of it
  • Is on the 'nice to have' list
  • Was decided that it wasn't useful enough to justify implementing

Solution 2:

The benefit is too small to justify complicating the language.

You don't need it that often, and it is easy to get the same effect cleanly with a few characters more.