[mercury-users] io.set_globals and uniqueness

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Oct 19 10:52:55 AEST 2005


On 13-Oct-2005, Michael Day <mikeday at yeslogic.com> wrote:
> 
> Why must the univ value passed to io.set_globals be unique?

I think the use of unique modes for io.set_globals and io.get_globals
is a bug.

I think the original reason for giving io.set_globals a "di" mode
is that io.get_globals has a "uo" mode, which can only be true if
io.set_globals has a "di" mode.  Unfortunately that is still not
a sufficient condition to allow io.get_globals to safely have a
"uo" mode, since the user could call io.get_globals twice in a
row and get two references to the same data.

> Are any bad
> things likely to happen if a non-unique value is passed after calling
> unsafe_promise_unique?

I think the answer is "no", so long as you are not relying on
the uniqueness of the value returned by io.get_globals.

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