Thanks for taking the time to write this out.

On Thu, 26 Sep 2002, John Williams wrote:
> perl6 operator precedence
>
>            left        terms and list operators (leftward) [] {} () quotes
>            left        . and unary .
>            nonassoc    ++ --
>            left        is but

This would lead to some scary things, I think:

        $a = 3 + 4 but false
        => (= $a (+ 3 (but 4 false)))

Of course, so does having low precedence:

        $a = 3 but false + 4
        => (= $a (but 3 (+ false 4)))

but I think the latter is unnatural enough that it deserves parens, so I'd
put 'but' above comma (and probably '='), but below just about everything
else.

> Larry mentions that other precedence unifications are possible.  I can see
> the following as possibilites.  Are there others?
>       & with &&
>       | with ||

It seems like a good idea to me to encourage people to think of bitwise
ops as mathematical, not logical, so I'd rather see them with different
precedences.  Plus, anything that significantly goes against people's
hard-wired C expectations will just lead to confusion and pain.  Finally,
having '|' below '&&' will probably lead to strange things, e.g.

        1|2 && 3|4
        => 1 | (2 && 3) | 4

/s

Reply via email to