[mercury-users] Abstraction barrier
    Michael Day 
    mikeday at yeslogic.com
       
    Tue May 13 17:23:10 AEST 2003
    
    
  
> One thing you might be able to do is give the `magic_data' argument a
> mode of `ui'.  This ensures that that argument will be a unique
> reference to the data after foo/3 exits.
Right, I just tried that. The limitations are not a problem, as it is a
foreign type, but I ran into a problem because one of the accessor
functions returns a component of the structure that must also stay unique,
and there is no way to enforce that.
The solution seems to be to change that accessor into a with_foo style
predicate that passes in the sub-component also with a ui mode.  
Incidentally, the issues with ui can often be worked around using di,uo
pairs, even when ui would be more appropriate, but that brings up a new
range of problems.
> If a string can go out of scope unexpectedly then you probably should
> make a copy of it on the Mercury heap.
Yes :)
Michael
-- 
YesLogic Prince prints XML!
http://yeslogic.com/prince
--------------------------------------------------------------------------
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