[m-rev.] for review: drop support for automatic solver type initialisation

Ralph Becket rafe at csse.unimelb.edu.au
Wed Oct 31 10:18:04 AEDT 2007


This all looks good.  I have only two comments:

Julien Fischer, Wednesday, 31 October 2007:
> 
> For review by Ralph.
> 
> Estimated hours taken: 10
> Branches: main
> 
> Remove support for automatic initialisation of solver types from the 
> language.
> This is being done because:
> 
> * the current implementation of automatic initialisation means we cannot
>   support polymorphic solver types, e.g. you cannot have the type foo(bar)
>   where:
>   		:- solver type foo(T).
> 		:- solver type bar.

It occurs to me that we also need a solver_type type class:

	:- typeclass solver_type(T) where [
		pred new_solver_var(T::oa) is det
	].

Then I can write something like

	:- instance solver_type(foo(T)) <= solver_type(T) where [
		( new_solver_var(foo(X)) :-
			new_solver_var(X)
		)
	].

> Index: compiler/type_util.m
> ===================================================================
> RCS file: /home/mercury/mercury1/repository/mercury/compiler/type_util.m,v
> retrieving revision 1.184
> diff -u -r1.184 type_util.m
> --- compiler/type_util.m	2 Oct 2007 04:32:49 -0000	1.184
> +++ compiler/type_util.m	30 Oct 2007 14:48:58 -0000
> @@ -97,6 +97,12 @@
>  :- pred type_body_has_solver_type_details(module_info::in,
>      hlds_type_body::in, solver_type_details::out) is semidet.
> 
> +    % Succeeds if this type is a solver type that has an initialisation
> +    % predicate specified by the user.
> +    %

You might want to change that to "specified by the user in the solver
type definition".

Otherwise that's fine.  Thanks for doing it!

-- Ralph
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list