[mercury-users] semidet vs unique updating

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Oct 19 15:12:56 AEST 2001

On 19-Oct-2001, Mark Brown <dougl at cs.mu.OZ.AU> wrote:
> What precisely is the condition that would guarantee uniqueness of a
> mostly unique object? 

If the mostly unique object was constructed from variables whose final
inst is `dead', then it should be unique.

> If this condition really is satisfied, then you
> could use unsafe_promise_unique to make up for incompleteness in the
> mode checking algorithm, right?  That way you wouldn't need to wait for
> the algorithm to become more clever.

Good point.

However, it turns out that the current mode checker doesn't properly
enforce the intended semantics of `dead', instead treating it the same as
`mostly_dead'.  So considerable care would be needed with this approach.

We really ought to fix the mode checker to handle the distinction
between `dead' and `mostly_dead' correctly.  In the mean time, if you
want destructive update for semidet procedures such like queue__get,
I'd suggest just using the det version that returns a maybe type, rather
than the semidet version.

Fergus Henderson <fjh at cs.mu.oz.au>  | "... it seems to me that 15 years of
The University of Melbourne         | email is plenty for one lifetime."
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- Prof. Donald E. Knuth
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