[Prev][Next][Index][Thread]

Re: precedence of | and &



On Wed, Mar 15, 2000 11:00 Uhr, Chris Double <mailto:chris@double.co.nz>
wrote:
>What are the advantages of & having lower precedence than |? What are
>the disadvantages of them both being the same precedence?
>
>Chris.
>

This comes from mathematics.

Rings (domains) provide internal operations + and * as well as
distributivity.

A * (B + C) == A * B + A * C
(other law omitted)

You probably easily accept * having greater precedence than + for numbers,
this is to write the distributivity law (naturally) without right hand side
parentheses.

Now there exists a smallest (nontrivial) ring called boolean algebra, that
also has * and +, we call them AND and OR.

The rest is analogy.

However I do not think that changing the precedences of | and & are
desirable at this point. Let's accept that they are macros (special) and
keep this in mind.

	Gabor