^ was always supposed to mean exponentiation. But it doesnt behave that way. What does it actually mean, and are there any member functions of Int that do exponentiation (other than math.pow)?
And why was it defined that way? It gets an operator precedence lower than arithemetic operations, when all other languages give it the highest precedence.
It’s bitwise exclusive or. You’ve probably never developed in C, C++, or Java, or…
It’s inherited from them. I don’t know how one would define what it’s “supposed” to be, but there’s certainly a lot of code written with this meaning.
Int (and RichInt) don’t have an exponentiation operator.
As far as precedence goes, it’s in the middle of the other logical operators, which is where it belongs given its actual meaning (as opposed to exponentiation).
If you really wanted to override the meaning of “^” within a restricted scope (something I do not recommend), I think you could do so using implicit parameters, thereby getting the high precedence you want. Or, more sanely, I think you could define a “to_the” or “**” operator the same way, getting the same high precedence.