[m-rev.] for review: comparison of preds/funcs

Zoltan Somogyi zs at cs.mu.OZ.AU
Thu Apr 25 14:32:19 AEST 2002


On 24-Apr-2002, Mark Brown <dougl at cs.mu.OZ.AU> wrote:
> I'm not sure what to do about this one.  Should I:
> 	- add two new MR_TypeStat structs for the new predicate, and fill
> 	  those in instead;
> 	- not record any stats at all for the new predicate;
> 	- leave them conflated, but add a comment to the documentation of
> 	  MR_TYPE_CTOR_STATS that says that the stats for compare also
> 	  include calls to compare_representation;
> 	- do something else

The third option (leaving them conflated, but documenting that fact) seems
simplest. They can be separated out later, if and when needed.

> Come to think of it, we shouldn't be insisting that the modes of the two
> procedures are the same.

If they are not, then the representations are different.

> The operational semantics of compare_representation
> are that we should compare only the name, arity and arguments of the closure.
> So comparing proc_ids is too strong.

We are deciding what the operational semantics ought to be. I think comparing
the entire contents of proc_ids is fine; I was just not sure about their
addresses. The code you have there is fine too. In the intended application,
the modes will match if the other parts of the proc_ids match.

> Also, by comparing the contents of the proc_ids, we make the operational
> semantics more predictable, which means that we *can* simply output the
> result in the test cases.

I agree.

> > Why the maybe?
> 
> Because two non-canonical terms could be equal, but still give a result
> other than (=).

But these test cases aren't checking whether the terms are semantically equal,
they are checking whether their representations are equal, and we can state
definitely if they are not.

> +++ library/std_util.m
>  	% XXX This predicate is not implemented for highlevel code.  This
>  	% is the reason it is not in the official part of the interface.

This should say "not YET implemented".

> Below is the relative diff.  Only the change to one of the test cases is
> shown, because interdiff got confused by the others.  The changes made to
> the other cases are analogous to this one.  I'm awaiting your advice on
> type_stat_struct before committing.

Go ahead and commit once you addressed the comments above.

Zoltan.
--------------------------------------------------------------------------
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