[m-dev.] for review: record where assertions used

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Jul 14 16:47:18 AEST 1999


On 14-Jul-1999, Peter Ross <petdr at cs.mu.OZ.AU> wrote:
> +assertion__record_preds_used_in(call(PredId, _, _, _, _, _) - _, AssertId,
> +		Module0, Module) :-
> +	update_pred_info(PredId, AssertId, Module0, Module).
> +assertion__record_preds_used_in(generic_call(_, _, _, _) - _, _AssertId,
> +		Module, Module).
> +assertion__record_preds_used_in(conj(Goals) - _, AssertId, Module0, Module) :-
> +	assertion__record_preds_used_in_goal_list(Goals, AssertId,
> +			Module0, Module).
[... 50 lines of code deleted ...]

I think it would be better to define this via

	assertion__record_preds_used_in(Goal, AssertId, Module0, Module) :-
		solutions(goal_calls_pred_id(Goal), PredIds),
		list__foldl(update_pred_info(AssertId), PredIds,
			Module0, Module).

The predicate goal_calls_pred_id/2 is defined in goal_util.m;
to make this work you would need to add a `(in, out) is nondet' mode
for that predicate (currently it only has an `(in, in) is semidet' mode).
You'd also need to swap the order of the first two arguments of
`update_pred_info'.

Once you've done this, the code in assertion.m will be fairly short;
you might want to consider whether it is long enough to justify being
in a separate module.  Alternatively, if you want to put the assertion
stuff in a separate module, then it might be a good idea to move the
definition of assertion_table from hlds_data.m to assertion.m.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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