-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Proposal
The shorter variants should be used for logical operators rather than bitwise operators as the former is used more often, so
&|~are the logical AND, OR, and NOT operators, respectively.&&||!are the bitwise AND, OR, and NOT operators, respectively.
^ should also be reserved for exponentiation, so XOR can be something obscure like ^^.
Rationale
&, |, and ~ have roots that might be more recognizable. For example, & is used in English for "and," and ~ is used for negation in math. | is already used in some syntaxes for multiple options, like regex a|b. ^ is commonly used for exponentiation.
In addition, a single character is easier to type (though admittedly the impact of this is negligible), so it should be used for the operator that is used more often.
Duplicating the symbol for bitwise operators would be in line with the bitwise shift operators, >> and <<. Good thing existing languages don't do it the other way around!