[mercury-users] semidet vs unique updating

Ralph Becket rafe at cs.mu.OZ.AU
Wed Oct 17 14:57:27 AEST 2001

Michael Day, Wednesday, 17 October 2001:
> > You should take a look at mostly_unique and mostly_dead insts, which
> > are described in the "Backtrackable destructive update" section of the
> > reference manual.  These may be closer to what you want.
> Is that basically a request to the compiler to make a copy automatically
> to allow backtracking? What I'm looking for here is a way to tell the
> compiler that making a copy is unnecessary, be it implicit or explicit.
> Alternatively I could just provide not_empty and get_det and leave the
> user to call them, but it seems like the compiler should be able to see
> that it's not modified.

The compiler trails updates to mostly-unique objects so that it can
undo any changes to them on backtracking, so your example will only
incur an small overhead, but would pay a price for every genuine

If this is a crucial performance problem for your application, you
could implement something using impure code and give it a pure

- Ralph
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