[m-dev.] Initialisation of solver type variables
Fergus Henderson
fjh at cs.mu.OZ.AU
Mon Apr 26 07:19:40 AEST 2004
On 22-Apr-2004, Ralph Becket <rafe at cs.mu.OZ.AU> wrote:
> [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, ...)
>
> into
>
> <<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'.
At the end of the clause body, you mean?
Sounds reasonable, assuming that there is an explicit mode declaration.
i.e.
:- mode p(..., free >> any, ...).
p(..., Y, ...) :-
... code which leaves Y free ...
would become
:- mode p(..., free >> any, ...).
p(..., Y, ...) :-
... code which leaves Y free ...,
<<call initpred>>(Y).
If there's no explicit mode declaration, then it may be better
to infer the mode free >> free rather than free >> any.
--
Fergus Henderson | "I have always known that the pursuit
| of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- 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