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

Peter Ross petdr at cs.mu.OZ.AU
Wed Jul 14 16:51:19 AEST 1999


On 14-Jul-1999, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> 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.
> 
Sounds good.

The future plans for this module are to add predicates like
assertion__is_associative, so I don't think it should be
folded into hlds_data.

Pete.
--------------------------------------------------------------------------
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