[m-rev.] for review: constrained polymorphic insts

David Overton dmo at cs.mu.OZ.AU
Thu Mar 14 09:41:43 AEDT 2002


On Wed, Mar 13, 2002 at 11:00:44PM +1100, Fergus Henderson wrote:
> On 07-Mar-2002, David Overton <dmo at cs.mu.OZ.AU> wrote:
> > +inst_matches_initial_4(ground(UniqA, _GII_A), bound(UniqB, ListB), MaybeType,
> >  		Info0, Info) :-
> >  	MaybeType = yes(Type),
> >  		% We can only check this case properly if the type is known.
> > -	GII_A \= constrained_inst_var(_),
> > -		% Don't overly constrain the inst_var.
> 
> Hmm, why did that test get removed?
> (The code is probably right, but please double-check it.)

GII_A has type ground_inst_info and that type no longer has a
constrained_inst_var alternative.

In the new version, this test is unnecessary since we allow
constrained_inst_vars insts to become further instantiated.

> 
> > @@ -838,6 +884,16 @@
> >  		% XXX how do we get the argument types for an abstract inst?
> >  	inst_list_matches_final(ArgsA, ArgsB, MaybeTypes, Info0, Info).
> >  inst_matches_final_3(not_reached, _, _, I, I).
> > +inst_matches_final_3(constrained_inst_vars(InstVarA, InstA), InstB, MaybeType,
> > +		Info0, Info) :-
> > +	( InstB = constrained_inst_vars(InstVarB, InstB1) ->
> > +		% Constrained_inst_vars match_final only if they are the same
> > +		% variable.
> > +		InstVarA = InstVarB,
> 
> s/InstVarA/InstVarsA/ and 
> s/InstVarB/InstVarsB/
> 
> Shouldn't this code be checking whether the two sets have any members
> in common (a non-empty intersection), rather than checking if they are
> equal?

That code should be

inst_matches_final_3(constrained_inst_vars(InstVarsA, InstA), InstB, MaybeType,
		Info0, Info) :-
	( InstB = constrained_inst_vars(InstVarsB, InstB1) ->
		% Constrained_inst_vars match_final only if InstVarsA contains
		% all the variables in InstVarsB
		InstVarsB `set__subset` InstVarsA,
		inst_matches_final_2(InstA, InstB1, MaybeType, Info0, Info)
	;
		inst_matches_final_2(InstA, InstB, MaybeType, Info0, Info)
	).

I have changed it.

> Apart from that, this change looks fine now.

Okay.  Thanks.



David
-- 
David Overton      Computer Science and Software Engineering
PhD Student        The University of Melbourne   +61 3 8344 9159
Research Fellow    Monash University (Clayton)   +61 3 9905 5779
--------------------------------------------------------------------------
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