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

Julien Fischer juliensf at cs.mu.OZ.AU
Wed Sep 22 23:46:21 AEST 2004


On Wed, 22 Sep 2004, Ralph Becket wrote:

> I've just been bitten for the nth time by the fact that (=>) binds more
> strongly than conjunction.  A goal like this will lead to (fairly
> unhelpful) compiler errors complaining about binding variables in a
> negated context:
>
> 	all [X] (
> 		p(X)
> 	=>
> 		q(X),
> 		r(X)
> 	)
>
> The problem arises because this is parsed as
>
> 	all [X] (
> 		( p(X) => q(X) ),
> 		r(X)
> 	)
>

> I recall asking that we change the priority of (=>) and (<=) to 1010
> (i.e. *above* (,) which has priority 1000) years ago and nobody was
> interested.
>

I don't have any objections to doing this, although I think that
if this happens we should also change the priority of (<=>)
correspondingly.

> Another point in this proposal's favour is that multiple type class
> constraints would no longer have to appear in parentheses.  That is, at
> present we have to write
>
> 	:- pred p(T) <= (foo(T), bar(T)).
>
> whereas with the changed precedence this would become
>
> 	:- pred p(T) <= foo(T), bar(T).
>

I think this is a convincing argument for doing this.  The former
syntax looks rather strange.

Cheers,
Julien.
--------------------------------------------------------------------------
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