[m-rev.] for review: typecheck error message simplification

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Jul 24 23:21:40 AEST 2001


On 24-Jul-2001, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> On 23-Jul-2001, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> > > +	(
> > > +		{ TypeStuffList = [ExampleTypeStuff | _] },
> > > +		{ list__all_same(TypeStuffList) }
> > > +	->
> > > +		{ ExampleTypeStuff = type_stuff(VType, TVarSet, TBinding) },
> > >  		io__write_string(" has type `"),
> > >  		write_type_b(VType, TVarSet, TBinding),
> > >  		io__write_string("'")
> > 
> > I don't think that is safe -- I think you need to apply the type bindings
> > before doing the test for the values being the same.  Otherwise you might
> > get some false hits.
> 
> Granted I don't know *exactly* what the semantics of the type_stuff constructor
> are, but I don't see how that code can be unsafe. If two elements of
> TypeStuffList are the same, then the code in both the then and the else
> branches will output the same for both elements, because neither takes any
> input *except* the list elements.

Ah, sorry, you're right -- I misread the code.
The change is safe. 

However, looking at it a bit more closely,
I'm pretty sure that it doesn't actually accomplish anything.

> It is possible that list__all_same is too conservative: some elements that are
> different before substitution may become identical after substitution. However,
> the code above should be a step in the right direction.

It would be, except that it's a step which has already been taken -- the code
in typecheck.m already checks for duplicate entries when constructing the list.
See the following lines in get_type_stuff:

        (
                list__member(TypeStuff, L0)
        ->
                L = L0
        ;
                L = [TypeStuff | L0]
        ).

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