[m-rev.] for review: use typeclass constraints to help resolve overloading

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Jan 22 00:36:01 AEDT 2002


On 21-Jan-2002, David Jeffery <dgj at miscrit.be> wrote:
> Hmmmmm, I just had a nasy thought: you can't get away with just looking
> at each predicate call in isolation to resolve the overloading because in
> general it isn't just the constraints from the 'head' of the caller that can
> be used to eliminate the constraints from the callee. Instead, it is the
> constraints from the head of the caller *and* any constraints produced
> in the body of the caller.
> 
> Here's the rub: you can't know which constraints are produced in the
> body until you've resolved overloading (so that you know which
> predicates are called, and thus know which constraints are produced).
>
> In other words, this final pass needs to do full-blown type checking,
> including building up a type_assign_set.
>
> The bottom line is that all of this stuff should be done at the end of
> typecheck, while all the information is still hanging around.

I don't think that's *needed* -- we could easily record which
constraints are produced in the body in the pred_info, like the way we
record the unproven constraints, and then use that in post_typecheck.m.

However, your suggestion might still be a good idea.
Apart from anything else, it might help to improve
the error reporting for such ambiguity errors, which
is currently pretty abysmal.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list