[m-dev.] Initialisation of solver type variables

Ralph Becket rafe at cs.mu.OZ.AU
Thu Apr 22 09:33:07 AEST 2004

[I've just discussed this with Peter and Maria, but thought it would be
worth posting to the list in case anyone else has a comment to make.]

If `X' belongs to a solver type and is `free' and appears as a mode
`(any >> ...)' argument in the call `p(..., X, ...)' then the Mercury
compiler first initialises by transforming

	p(..., X, ...)


	<<call initpred>>(X),
	p(..., X, ...)

It occurred to me that the compiler should also append calls to
`initpred' for output variables that should have inst `any' but
are in fact `free'.  This is not hard to arrange.

This leads on to the question of what to do when there are outstanding
unifications that could be turned into constructions provided their
solver type argument variables are initialised.  That is, if we have

	% X `with_inst` free, Y `with_inst` free, Y is a solver type,
	% f is a data constructor.
	X = f(Y)

then the compiler can try turning this into a construction by doing

	<<call initpred>>(Y),
	X = f(Y)
	% X `with_inst` bound([f(any)]), Y `with_inst` any

Which is what I plan to implement.  Can anyone see a problem with this

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