[m-dev.] Precedence of (,), (<=) and (=>) (...again)

Peter Moulder Peter.Moulder at infotech.monash.edu.au
Wed Sep 29 12:37:23 AEST 2004

I'm concerned by a proposal to change the meaning of existing code
in this way.

Mentioning it in the NEWS list does little to help if people have no
means of searching old code for occurrences of

   p(X) => q(X),

Can people be given a tool to find such occurrences (i.e. places where
old & new priorities differ) ?

Could the compiler warn if the relative priority of (,), (<=) etc.
matters?  (Ideally with a directive to be placed in source code to say
"this source file assumes (,) binds more tightly than (=>) and

While considering changing operator priorities, may I suggest making
`some' bind less tightly than `,' and `&' ?  I.e. that in

  ( some[X] p(X), q(X) )

we should take the two X occurrences to be the same variable.

This gives us better support for introducing local scopes (so that one
needn't search for all occurrences of X to know the relevant scope or
set of constraints on X).

Consider also the variant `some[!X] ...', and I think it was planned to
allow `some[X:int] ...'.

An aesthetic argument is that existential quantification is a form of
disjunction, which suggests its priority should be similar.  There are
considerable parallels with how multiplication is considered to bind
more tightly than the addition-like \sum (\Sigma) operator.

mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au

More information about the developers mailing list