Getting people to remember the new precedences when writing new code would probably be really hard,
Actually, the proposed precedence should be easier to remember since it groups the bit-wise operators together and places them in a much more logical place in the order. (I'll just set aside my proposed change to the precedence of !, which I have changed my mind about.) I also doubt that most Perl programmers have bothered to memorize the current precedence of these particular operators as it is nearly non-sensical as well as mostly useless. The only thing worth memorizing about the current state is that you need to always use parens when dealing with bit-wise operators. If you do that, then a change in the precedence will have no effect on you.
Like you said, there'd be a flood of "why doesn't my script work?" questions.
I'd really like to see a single production script that would be affected by this change. To do so, it would have to be using code like what you wrote: if( 0 == $mask & $value ) { which gets parsed as: if( ( 0 == $mask ) & $value ) { which computes a value of 1 or 0 (depending whether $mask is 0 or not), then does a bit-wise "and" with $value. When would you ever write code like that? You want to know whether $value is odd, but only if $mask is non-zero? If so, there are much clearer ways to write such code.
Using bit-wise operators on the Boolean results of comparison operators is a pretty useless act. Even the "named unary operators" return values that you are quite unlikely to want to perform bit-wise operations on.
- tye (but my friends call me "Tye")In reply to (tye)Re: Will/Can Perl 6 clean up the bit-wise operator precedence mess?
by tye
in thread Will/Can Perl 6 clean up the bit-wise operator precedence mess?
by tye
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |