[m-dev.] Quick solver types question

Ralph Becket rafe at cs.mu.OZ.AU
Wed Feb 4 17:07:51 AEDT 2004

Hi David,

I hope the trip to England wasn't too gruelling and that you're enjoying
a chance to recover!  My Dad just sent me some photos from Wales and
it's covered in snow up there, so I'm guessing the south of England is
pretty bloody freezing right now.  The local temperature icon on my
computer tells me it's a beautiful 24'C outside and the forecast is for
even better weather in the next few days.  Not that I want to rub it in
or anything!

Quick question: you mentioned that the Mercury mode checker will
automatically insert calls to initilisation predicates for solver types
when a variable has to be converted from inst free to inst any.  I wrote
a little program to see what gets generated, but the compiler had a

:- module foo.

:- interface.

:- solver type t ---> a(int).

:- implementation.

:- func hmm = (t::out(any)) is det.
hmm = id(_).

:- func id(t::in(any)) = (t::out(any)) is det.
id(X) = X.

$ mmc --make foo
Making Mercury/int3s/foo.int3
Making Mercury/cs/foo.c
foo.m:010: In clause for `hmm = out(any)':
foo.m:010:   in argument 1 of call to function `foo.id/1':
foo.m:010:   sorry, implied modes not implemented.
foo.m:010:   Variable `V_2' has instantiatedness `free',
foo.m:010:   expected instantiatedness was `any'.
For more information, try recompiling with `-E'.
** Error making `Mercury/cs/foo.c'.

Looking at modecheck_call.m it seems that
modecheck_call.modecheck_end_of_call is responsible for actually
scheduling the goal and is where, I presume, the calls to initialise
free solver variables should be introduced.  However, that predicate
ignores the actual insts of the argument variables and just uses the
insts from the argument modes of the procedure being scheduled.  So it
doesn't have enough information to insert initialisation calls.

If code for the introduction of the initialisation calls still needs to
be written, I take it this is one of the places to do so?

If you get a chance to give me a pointer on this one I'd be very
grateful - but I understand completely that you're out of here and have
a *heap* of stuff to sort out!

All the very best!
-- 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