[m-dev.] for review: change typeclass_info structure

Fergus Henderson fjh at cs.mu.OZ.AU
Tue May 23 02:18:56 AEST 2000


On 04-Apr-2000, David Glen JEFFERY <dgj at cs.mu.OZ.AU> wrote:
> On 03-Apr-2000, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> > On 31-Mar-2000, David Glen JEFFERY <dgj at cs.mu.OZ.AU> wrote:
> > > Index: compiler/polymorphism.m
> > > @@ -2134,10 +2025,14 @@
> > >                                  % already been reversed, so lets
> > >                                  % reverse them back.
> > >                          list__reverse(TypeInfoGoals, RevTypeInfoGoals),
> > > +                        list__reverse(UnconstrainedTypeInfoGoals, 
> > > +                                RevUnconstrainedTypeInfoGoals),
> > >  
> > >                          list__append(ExtraGoals1, RevTypeInfoGoals,
> > >                                  ExtraGoals2),
> > > -                        list__append(NewGoals, ExtraGoals2, ExtraGoals)
> > > +                        list__append(NewGoals, ExtraGoals2, ExtraGoals3),
> > > +                        list__append(RevUnconstrainedTypeInfoGoals,
> > > +                                ExtraGoals3, ExtraGoals)
> > 
> > Hmm, the order of the goals there looks a little strange.
> > Why do the RevTypeInfoGoals get put at the end, whereas
> > the RevUnconstraintTypeInfoGoals get put at the start?
> 
> The goals are in the same order as the values that they generate appear in
> the type class info.

The goals that end up in ExtraGoals are, but the calls to list__append aren't,
if you see what I mean.

IMHO, it would be much clearer to replace that sequence of calls to
list__append with various intermediate variables with a single call to
list__condense.  That is, instead of

                          list__append(ExtraGoals1, RevTypeInfoGoals,
                                  ExtraGoals2),
                          list__append(NewGoals, ExtraGoals2, ExtraGoals3),
                          list__append(RevUnconstrainedTypeInfoGoals,
                                  ExtraGoals3, ExtraGoals)

write

			  list__condense([RevUnconstrainedTypeInfoGoals,
			  	NewGoals, ExtraGoals1, RevTypeInfoGoals],
				ExtraGoals)

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