Open dloscutoff opened 3 years ago
If implemented, can this also reverse argument evaluation order?
Interesting thought! I can see how that would be useful sometimes. From a quick look at the code, it also appears that the easiest way to implement ~
would be to swap the first and second branches of the expression's parse tree before evaluating, which would indeed result in the rhs being evaluated first. I'll have to think some more about how that would work when combined with the :
meta-operator, though.
Sometimes, it would be useful to reverse the operands of a binary operator. For example, to yank an expression and then use it as the lower bound of a Range:
There is currently no way to save the parentheses, unless it's possible to rearrange the program so the yank happens first and then the expression is
y,c
.If
~
were a meta-operator that swapped an operator's left and right operands, we could dopotentially saving a byte.
TBD: What does the meta-operator do when applied to a ternary operator?