Re: Why not == ?
- Posted by ghaberek (admin) Nov 07, 2022
- 399 views
SDPringle said...
I like the idea of using Python like relationals:
a == b == c is true iff a == b and b == c a < b < c is true iff a < b and b < c
This is another breaking change.
Right now we'd be using if a = b and b = c or if a < b and b < c which IMHO is perfectly fine, but it certainly gets verbose and eliminating the extra b could help reduce errors.
A backwards-compatible option here would be to allow equal() and compare() to accept more than two parameters, or simply a third parameter, that defaults to NOVALUE.
So a == b == c becomes equal(a, b, c) and returns 1 if all parameters are equal and a < b < c becomes compare(a, b, c) and returns -1 if each parameter is less than the next, etc.
-Greg