For me that notation has one drawback: what should happend if
y = 5
and you'll write
[x, y == 1, 2]
?
Is it an array with three elements
[x, false, 2]
?
or an array with one element which has value of "multiple comaprision"
[false]
?
That would be a problem indeed. Note that the same aplies
to method calling: foo(a, b == 1, 2)
The expansion of (x, y == 1, 2) should then occur only outside
parameter lists.
It should be just 'false', as expressed in the first message (i.e.
x==1 and 5==2)
It surely shouldn't be false, because that would disable
comparisons inside parameter lists.
I mean, if we consider ',' as an expression that creates a list
object, than 1,2 == could be just some kind of sugar.
But chosing some kind of precedence would probably be impossible, or
wqould break many of the actual behaviours.
I wouldn't consider ',' as an expression that creates any object,
but rather as a way to pass multiple arguments to methods and
continuations. This is close to the way it actually is in Ruby.
This would be a syntax extension. However (x, y == exp1, exp2)
would be different from (x == exp1 && y == exp2) because it would
evaluate the parameters first, and then compare the results.
Another construct that might be useful:
x, y += 1, 2
#(meaning x += 1; y += 2)