[mercury-users] Mutually exclusive goals

Fergus Henderson fjh at cs.mu.OZ.AU
Sat Aug 7 11:34:57 AEST 1999

On 16-Jul-1999, Peter Schachte <schachte at cs.mu.OZ.AU> wrote:
> It would be instructive to go through a large body of Mercury code,
> (eg, the Mercury compiler) looking for code that works around this
> problem.  It shouldn't be too hard to find places where exhaustiveness
> declarations are needed, because they should have funny error goals
> saying that the error should never happen.  I suspect that trying to
> find places where exclusiveness declarations would help would be
> pretty hard because they're probably all hacked around to make them
> det.
> Any Mercury hackers care to post some examples of where exclusivity or
> exhaustiveness declarations would have helped?

Most of the calls to error/1 in the Mercury compiler come from places
where there are additional constraints on the input arguments which
the type system cannot express, e.g. that two lists must have the same
length.  I don't think there would be many examples of where exhaustiveness
might have helped; off-hand, I can't think of any.

The advantage of exclusiveness or exhaustiveness declarations would be
that we could make the source code a bit more abstract, using ADTs in
cases where we currently use concrete discriminated union types.

Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at        |     -- the last words of T. S. Garp.
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