You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed that compound assignment won't work with certain operators, like |> and ∘.
For example, the following code gives the error "ERROR: syntax: unexpected "="" on line 2:
a = 2
a |>= exp
But if I say, redefine the * operator as |>, it works perfectly:
import Base.*
* = |>
a = 2
a *= exp
outputs 7.389, as it should. The same thing happens with the function composition operator. So clearly the language is able to do this, the parser just doesn't handle it properly with all operators. I tried this in both 0.6.4 and 0.7 and got the same results. Is there some deeper reason why this doesn't currently work?
The text was updated successfully, but these errors were encountered:
It's not really a "deep" reason, but right now the parser code uses an explicit list of assignment operators and a corresponding explicit list of lowering rules. It's impractical to extend this approach to all possible binary operators, so some surgery on the parsing/lowering code would be required.
I noticed that compound assignment won't work with certain operators, like |> and ∘.
For example, the following code gives the error "ERROR: syntax: unexpected "="" on line 2:
But if I say, redefine the * operator as |>, it works perfectly:
outputs 7.389, as it should. The same thing happens with the function composition operator. So clearly the language is able to do this, the parser just doesn't handle it properly with all operators. I tried this in both 0.6.4 and 0.7 and got the same results. Is there some deeper reason why this doesn't currently work?
The text was updated successfully, but these errors were encountered: