[m-dev.] diff: "superclass search"

David Glen JEFFERY dgj at cs.mu.OZ.AU
Tue May 5 17:45:17 AEST 1998


On 05-May-1998, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> 
> I'd like to see a proof of termination for this algorithm.
> I think it won't terminate in the case where the class
> hierarchy is cyclic, and I think we currently don't check
> whether the class hierarchy is cyclic.

Yes, you are right.

> If case like this
> 
> 	:- typeclass c1(T) <= c2(T) where [].
> 	:- typeclass c2(T) <= c1(T) where [].
> 
> were the only ones we had to worry about, modifying
> the algorithm so that it always terminates would be
> pretty easy.  But we also need to worry about cases
> like this:
> 
> 	:- typeclass c3(T) <= c4(list(T)) where [].
> 	:- typeclass c4(T) <= c3(list(T)) where [].

Errors like this are picked up in prog_io.m since only type variables may
appear in constraints on type class declarations.

However, we do need to catch things like your first example.

> 
> Thus the simplest thing to do is probably to check
> for cyclic class hierarchies.  I guess this could be
> done in make_hlds.m when you're constructing the
> subclass table.

Yes. I will implement that now.


love and cuddles,
dgj
-- 
David Jeffery (dgj at cs.mu.oz.au) |  Marge: Did you just call everyone "chicken"?
MEngSc student,                 |  Homer: Noooo.  I swear on this Bible!
Department of Computer Science  |  Marge: That's not a Bible; that's a book of
University of Melbourne         |         carpet samples!
Australia                       |  Homer: Ooooh... Fuzzy.



More information about the developers mailing list