Bug SS-55
4 votes

Assignment operator priority

Created by Martin Kraska on 3/23/2014 6:48 PM Last Updated by Martin Kraska on 2/28/2018 9:40 PM
%
 (hrs)
Logged: 0   (hrs)

 Description

The assignment operator := has a higher priority than the boolean operators. Therefore, expressions like c := a≡b are interpreted as (c := a)≡b, which is most likely not the intent of the user. The same holds for other boolean operators. However, and, or and xor enforce parens around their arguments, such that the wrong expression immediately can be recognized.

boolshit.PNG

    Martin Kraska (Wednesday, February 28, 2018 9:40 PM) #

Status update with build 6626:

Some of the operators behave as expected, some don't. An improvement is that now you see the priority immediately by the added brackets. An assignment sometimes require to bracket the right hand side, sometimes not. I prefer to never require the rhs to be bracketed in an assignment.

However, the editor behaviour is strange, If you type a:b and then add an low priority operator, the left side a:=b is put in brackets and the cursor is placed to the left of the operator instead to the right. This is just a strange side effect, no point in fixing this without fixing the priorities.

Is there any explanation why the priority of exclusive or is different to that of or?

    Mike Kaganski (Wednesday, April 13, 2016 4:29 AM) #

Currently, this has become a "feature" (confusing, I must say), used for commenting purposes (esp. in blocks), e.g.:

a:=1="This is a comment"