[mercury-users] Unique and mostly-unique modes

David Overton dmo at cs.mu.OZ.AU
Thu Sep 8 18:22:42 AEST 2005


On Thu, Sep 08, 2005 at 09:02:38AM +0100, David Overton wrote:
> On Thu, Sep 08, 2005 at 02:35:48PM +1000, Ralph Becket wrote:
> > > test.m:018: In clause for `write(in, di, uo)':
> > > test.m:018:   mode error: argument 3 did not get sufficiently instantiated.
> > > test.m:018:   Final instantiatedness of `HeadVar__3' was
> > > test.m:018:   `unique(test.socket(ground))',
> > > test.m:018:   expected final instantiatedness was `unique'.
> > > 
> > > How is this incorrect? Surely unique(socket(ground)) <= unique.
> > 
> > Indeed.
> 
> This one has been correctly identified by the compiler as a mode error.
> The argument to socket/1 is not unique because it is also returned as
> the first argument of read/3 and so there is more than one live
> reference to it.  The inst `unique' means unique all the way down.
> 

Sorry, that should be write/3, of course.  However, the rest of what I
said above still applies.  If you change the mode to write(di, di, uo)
is should work.

David
-- 
David Overton
WWW: http://www.overtons.id.au/
Mobile Phone (UK): +44 7799 344 322
--------------------------------------------------------------------------
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