[m-dev.] purity of `:- pragma foreign_proc'

Peter Schachte schachte at cs.mu.OZ.AU
Wed Oct 31 07:22:03 AEDT 2001


> Before the `:- pragma foreign_proc' syntax becomes widely
> used, we should decide what the default purity for foreign
> procedures should be. If we are going to make people change
> their `:- pragma c_code' declarations to `:- pragma foreign_proc',
> we should make any purity annotation changes happen at the same time.
> 
> At the moment, predicates defined using `:- pragma foreign_proc'
> are `pure' by default, but predicates defined using mode-specific
> clauses are `impure' by default, even though `:- pragma foreign_proc'
> can implement a strict superset of the `impure' behaviour that can be
> implemented using mode-specific clauses.

Good point.  Probably impure should be the default.  One simple extension
would be to support the syntax

	:- pragma pure foreign_proc ...

so purity could be concisely specified.  Going further, Mercury could
require one of pure, impure, or semipure to always be stated in the
foreign_proc declaration, between pragma and foreign_proc.  That approach
would get my vote.


-- 
Peter Schachte              Wherever you go...There you are.
schachte at cs.mu.OZ.AU            -- Buckaroo Banzai 
www.cs.mu.oz.au/~schachte/  
Phone: +61 3 8344 9166      
--------------------------------------------------------------------------
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