[m-dev.] for review: improvements to type specialization [2]

David Glen JEFFERY dgj at cs.mu.OZ.AU
Thu Sep 30 19:49:44 AEST 1999


> Index: compiler/make_hlds.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/compiler/make_hlds.m,v
> retrieving revision 1.306
> diff -u -u -r1.306 make_hlds.m
> --- make_hlds.m	1999/09/21 07:23:31	1.306
> +++ make_hlds.m	1999/09/30 01:04:56
>  
> +:- pred multiple_subst_vars(list(T), list(T)).
> +:- mode multiple_subst_vars(in, out) is det.
> +
> +multiple_subst_vars([], []).
> +multiple_subst_vars([H | T], Vars) :-
> +	multiple_subst_vars(T, Vars0),
> +	( list__member(H, T) ->
> +		Vars = [H | Vars0]
> +	;
> +		Vars = Vars0
> +	).

As the type signature shows, there's nothing about this pred which relies on
its arguments being vars... Maybe you should give it a more restrictive type
to show how it is meant to be used, or give it a more general name
(eg. find_duplicate_list_elements).

> Index: compiler/polymorphism.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/compiler/polymorphism.m,v
> retrieving revision 1.171
> diff -u -u -r1.171 polymorphism.m
> --- polymorphism.m	1999/09/21 07:09:58	1.171
> +++ polymorphism.m	1999/09/29 00:43:15
> @@ -925,9 +928,9 @@
>  	%
>  	% figure out the list of universally quantified type variables
>  	%
> -	term__vars_list(ArgTypes, HeadTypeVars0),
> -	list__remove_dups(HeadTypeVars0, HeadTypeVars),
> -	list__delete_elems(HeadTypeVars, ExistQVars, UnivQTVars),
> +	%term__vars_list(ArgTypes, HeadTypeVars0),
> +	%list__remove_dups(HeadTypeVars0, HeadTypeVars),
> +	%list__delete_elems(HeadTypeVars, ExistQVars, UnivQTVars),

It is hard to work out from the diff why these are commented out and not
deleted.


Otherwise, this diff looks fine. You may like to have someone who is more
familiar with higher_order.m look at it, though.


dgj
-- 
David Jeffery (dgj at cs.mu.oz.au) | If your thesis is utterly vacuous
PhD student,                    | Use first-order predicate calculus.
Dept. of Comp. Sci. & Soft. Eng.|     With sufficient formality
The University of Melbourne     |     The sheerist banality
Australia                       | Will be hailed by the critics: "Miraculous!"
                                |     -- Anon.
--------------------------------------------------------------------------
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