[m-rev.] pragma no_export

Julien Fischer juliensf at csse.unimelb.edu.au
Tue Jul 13 14:13:41 AEST 2010


On Tue, 13 Jul 2010, Peter Wang wrote:

> In exception.m there is:
>
>    % NOTE: since there is no guarantee that modules that opt import these
>    % predicates will be compiled with `--no-reorder-disj' we need to make
>    % sure they are not inlined in other modules.
>
>    :- pragma no_inline(get_determinism/2).
>
> It turns out, however, that intermod.opt copies get_determinism into the
> .opt file anyway because it has a higher-order argument and so satisfies
> a different condition.  Is this a bug?

Yes, the no_inline pragma should mean that the clauses for
get_determinism are not included in the .opt file. regardless of any
other conditions that say it should be in the .opt file.

> Do we need a :- pragma no_export, which would allow inlining within the
> module but prevent opt-exports?

I think a better solution would be to have a new language construct
(e.g. a new scope or operator), that allowed for more precise control
over the semantics of a single disjunction, e.g.

     foo(...) :-
 	strict_sequential (
 		<A>
 	;
 		<B>
 	;
 		<C>
 	).

The advantage of this is that things like get_determinism can safely be
inlined across module boundaries and the entire modules don't have to be
complied with --no-reorder-disj just because a couple of predicates need
it.  (You can, of course, achieve this with impurity but sometimes that
is quite heavy-handed.)

> This could be useful, too, for foreign_procs where I have been using
> `may_not_duplicate' instead.

Or perhaps there should an additional foreign_proc attribute, 
`only_duplicate_locally', which restricts any inlining of the foreign
proc to that module?

Julien.
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list