[mercury-users] Newbie problem. :)

Thomas Conway conway at cs.mu.OZ.AU
Thu Jun 17 11:39:08 AEST 1999


On Thu, Jun 17, 1999 at 10:37:28AM EST, Richard A. O'Keefe wrote:
> To be in the public interface, all the predicates in such a rule must
> be publically available, although not necessarily exported by this
> module.

Which raises the question: Does it make sense for a module to promise
mutual exclusion between predicates exported by other modules? This
sounds like an invitation for a mess to me, though I'm quite happy to
be convinced otherwise.

Hmmm. Now I think about it I'm feeling worried about mutual exclusion
declarations in general. Say I have two predicates `p' and `q' which
I declare to be mutually exclusive, and I write the goal:

	...,
		% X is an output of both p and q.
	(
		p(..., X)
	;
		q(..., X)
	),

Without the declaration, determinism analysis will give up and say the
code is nondet (which may well be an error). With the declaration, there
are two possible interpretations:
	(
		p(..., X0)
	->
		X = X0
	;
		q(..., X)
	)
and
	(
		q(..., X0)
	->
		X = X0
	;
		p(..., X)
	)

Now, if I lied in my declaration (or had a bug either in the
specification or in the code), then the two interpretations are
not equivalent.

Okay, so it's nothing new - if your assertions are wrong you get what
you asked for, but this is a contrast to types, modes, and determinism
in the current system, which are *checked* to make sure that they are
consistent.

I agree that for the builtin types int and float, either the compiler
needs builtin knowledge or you need uncheckable assertions, but for
general mutual exclusion declarations, it would be nice to have them
checked. If you restrict the declarations so that I can only declare
mutual exclusion for predicates defined in *this* module, then checking
should be possible.

Thomas
-- 
 Thomas Conway  )O+  |   Master, I go hunting.
     Mercurian       |     -- Le Guin, A Wizard of Earthsea
<conway at cs.mu.oz.au> |
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list