[m-dev.] existential types

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Aug 24 13:58:58 AEST 2000


On 24-Aug-2000, Thomas Conway <conway at cs.mu.OZ.AU> wrote:
> How about this hack (assuming the original definition of the term type):
> 
> unifyTerms(LHS, RHS, Bind0, Bind) :-
>     LHS = ext(LData),
>     (
>     	RHS = ext(RData0),
> 	RUniv = univ(RData0),
> 	RUniv = univ(RData),
> 	unify(LData, RData, Bind0, Bind)
>     ;
>     	RHS = var(_),
> 	...
>     ).
> 
> [Goes away and tries this...]
> 
> Well, it compiles, and I don't see why it shouldn't work.

Yes, that should work.  The solution that I posted a minute ago
does essentially the same thing, but with a different spelling.

> Question: Is there a nicer way to do it?

I think it's nicer if you abstract out the code which does the dynamic
cast into a subroutine.  (That dynamic_cast subroutine might be a good
candidate for the standard library...)

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- 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