[m-dev.] for review: type specialization and functions

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Oct 14 13:44:14 AEST 1999


On 14-Oct-1999, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
> 
> diff -u -u -r1.309 make_hlds.m
> --- make_hlds.m	1999/10/12 01:55:35	1.309
> +++ make_hlds.m	1999/10/12 05:07:50
> @@ -915,8 +917,18 @@
>  		goal_info_set_nonlocals(GoalInfo0, NonLocals, GoalInfo1),
>  		goal_info_set_context(GoalInfo1, Context, GoalInfo),
>  		invalid_proc_id(DummyProcId),
> -		Goal = call(PredId, DummyProcId, Args,
> -			not_builtin, no, SymName) - GoalInfo,
> +		(
> +			PredOrFunc = predicate,
> +			Goal = call(PredId, DummyProcId, Args,
> +				not_builtin, no, SymName) - GoalInfo
> +		;
> +			PredOrFunc = function,
> +			pred_args_to_func_args(Args, FuncArgs, RetArg),
> +			ConsId = cons(SymName, Arity),
> +			create_atomic_unification(RetArg,
> +				functor(ConsId, FuncArgs), Context,
> +				explicit, [], Goal)
> +		),

I think this code won't properly handle the case where the function name
is overloaded.  I think you need to use a fully-qualified SymName,
to avoid ambiguity, but the one you are passing here might not be
fully-qualified.

Also, the call to invalid_proc_id/1 should be moved to inside the disjunction.

> ===================================================================
> RCS file: /home/mercury1/repository/tests/hard_coded/type_spec.m,v

I suggest you add some test cases here for overloaded functions.

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