[m-dev.] Inserting type class method calls during mode scheduling

Ralph Becket rafe at cs.mu.OZ.AU
Fri Jan 14 11:09:10 AEDT 2005


[Zoltan, you've been working with type_infos and typeclass_infos and I
seem to recall you saying there were some tricky cases involved in
inserting type class method calls.  If you can tell things to look out
for here I'd be v. grateful.]

I need to fix up the initialisation of polymorphic solver type
variables.  The current plan is to add a built-in type class:

	:- type class initialisable(T) where [
		pred initialise(T::out(any)) is det
	].

then make solver types instances of initialisable.  That is,

	:- solver type t where ..., initialisation is p, ...

will imply

	:- instance initialisable(t) where [
		pred(initialise/1) is p
	].

A predicate that may need to initialise polymorphic solver type
variables will need to have an initialisable(T) constraint on its type
signature for every such type variable.

Mode scheduling of solver goals may the insertion of initialisation
calls for solver variables before other goals can be scheduled.  If the
type of the variable is polymorphic, we have to insert a call to the
initialise method for that type (if, indeed, it is a member of
initialisable).

I'm going to start implementing this on Monday; I believe this is a
complicated part of the compiler, so does anyone know of any problems I
should watch out for?

Ta,
-- Ralph
--------------------------------------------------------------------------
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