in reply to Re: (tye)Re: Will/Can Perl 6 clean up the bit-wise operator precedence mess?
in thread Will/Can Perl 6 clean up the bit-wise operator precedence mess?

At first, it made sense to me to get the bit-wise operators finally grouped together and also get the logical operators finally grouped together. Plus, I'd been recently surprised by the rather tight binding of !.

But ! is also useful for extracting a Boolean value from a possibly-non-Boolean value. And since we don't have operators for "is logically equivalent" nor for "is not logically equivalent", it can be convenient to write, for example: if(  ! $expr == ! $cond  ) { Also, we do have negated versions of all of the comparison operators so there isn't much need for: if(  ! ( $value == $expr )  ) { So I realized that this change wasn't going to fly.

But the main point of my proposal was the bit-wise operators (hence the title). I snuck the change to ! into the table but didn't mention it anywhere. And now I'm sneaking it back out. q-: Sorry for the confusion.

It does make some (though not a lot of) sense to put ! in with the other unary operators.

        - tye (but my friends call me "Tye")

Replies are listed 'Best First'.
Re: (tye)Re2: Will/Can Perl 6 clean up the bit-wise operator precedence mess?
by theorbtwo (Prior) on Mar 18, 2003 at 02:11 UTC

    Your reasons for doing this are somwhat bogus -- in perl6, one of the new operators (that you're ignoring in the table, so it's reasonable to overlook them) is a boolification operator, so you don't have to abuse !. Simply write ?$expr == ?$cond. Also, you could define a new operator, say infix:ile (for Is Logicly Equivlent To):

    sub infix:ile is tighter(==) { ?$^a == ?$^b }
    (This uses theDamien's placeholder vars, which I'm not sure are in exactly as I've used them. I need to find time to read A6 again, more carefuly. Also, it may be possible to write this as...
    sub infix:ile($a is bool, $b is bool) is tigheter(==) { $a == $b }
    And rely on the compiler to coerce the arguments to bools.)


    Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).

      Um, to call my reasons (from over 1.75 years ago) "bogus" using features that were announced a few weeks ago is rather silly, no?

                      - tye

        Sorry, I didn't notice the date on this thread, I just saw it mentioned on the chatterbox recently. That does explain why I didn't notice it on newest nodes... ;)


        Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).