[m-dev.] for review: Aditi updates[3]

Fergus Henderson fjh at cs.mu.OZ.AU
Sun Jun 27 18:19:06 AEST 1999


On 05-Jun-1999, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
> +++ pd_util.m	1999/05/18 03:39:55
[in pd_util__goals_match_2:]
> @@ -933,12 +933,20 @@
>  			OldGoal = call(PredId, ProcId, OldArgs, _, _, _) - _,
>  			NewGoal = call(PredId, ProcId, NewArgs, _, _, _) - _
>  		;
> -			OldGoal = higher_order_call(OldVar, OldArgs1, Types,
> -					Modes, Det, PredOrFunc) - _,
> -			NewGoal = higher_order_call(NewVar, NewArgs1, Types,
> -					Modes, Det, PredOrFunc) - _,
> -			OldArgs = [OldVar | OldArgs1],
> -			NewArgs = [NewVar | NewArgs1]
> +			% XXX we could do better matching the types and modes
> +			% here.
> +			OldGoal = generic_call(OldGenericCall, OldArgs1,
> +					Modes, Det) - _,
> +			NewGoal = generic_call(NewGenericCall, NewArgs1,
> +					Modes, Det) - _,
> +			functor(OldGenericCall, GenericCallType, _),
> +			functor(NewGenericCall, GenericCallType, _),
> +			goal_util__generic_call_vars(OldGenericCall,
> +				OldArgs0),
> +			goal_util__generic_call_vars(NewGenericCall,
> +				NewArgs0),
> +			list__append(OldArgs0, OldArgs1, OldArgs),
> +			list__append(NewArgs0, NewArgs1, NewArgs)

I think this code is buggy, because the test using functor/3
will consider all aditi_builtins to be equivalent.

In any case, functor/3 is not very efficient.  I think it would
be better to write a match_generic_call predicate which handles
each case separately.

Also, the comment here is not clear, IMHO --
I think you should explain things in more detail.

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