[m-dev.] [reuse] fixes of some naughty bugs

Peter Schachte schachte at cs.mu.OZ.AU
Fri Mar 9 10:40:01 AEDT 2001


Hi Nancy,

This change made me wonder:  how do you handle impure code?  It occurred to
me that a foreign predicate could easily store away a term that was passed
in, and another foreign pred could return it back to Mercury, creating a
perfectly invisible alias.  Such foriegn predicates really should be
declared impure and semipure, respectively.  I'm afraid this means that you
have to assume that all arguments of every impure or semipure goal are
aliased.  You may be able to do a little better than this, but probably not
much.

Worse still, since foreign predicates are assumed pure unless specifically
declared impure, it's not unlikely things like this will be done without
being marked impure.  Of course, that woudl be a buggy program, so you're not
obliged to get this right.


-- 
Peter Schachte <schachte at cs.mu.OZ.AU>  Brook's Law: Adding manpower to a
http://www.cs.mu.oz.au/~schachte/      late software project makes it later 
Phone:  +61 3 8344 9166                
Fax:    +61 3 9348 1184                
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list