[m-rev.] diff: fix bugs with existential types & secondary tags

Fergus Henderson fjh at cs.mu.OZ.AU
Mon Apr 30 22:43:33 AEST 2001


On 30-Apr-2001, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> On 29-Apr-2001, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> > @@ -143,8 +146,13 @@
> >  **
> >  **                  for (i = 0; i < arity; i++) {
> >  **                      if (MR_arg_type_may_contain_var(functor_desc, i)) {
> > +**                          MR_Word *parent_data = (MR_Word *) new_data;
> > +**			    if (have_sectag) {
> > +**				// skip past the secondary tag
> > +**				parent_data++;
> > +**			    }
> 
> Instead of defining parent_data here, you should have defined it here:
> 
> > +**                  if (!have_sectag) {
> >  **                      sectag = 0;
> >  **                  } else {
> >  **                      sectag = data_value[0];
> 
> since that is where decisions that depend on the presence or absence of
> secondary tags are made.

There are already several (three) places which test sectag there, rather
than a just one.  From a readability perspective, I think it's better
to define parent_data locally, closer to where it is used.

Note that this is all in the comments anyway.
In the actual code, the test of have_sectag will get optimized away.

> Also, you inserted a good number of tabs into this file, which has four-space
> indentation. Please remove them, e.g. by running "detab".

What's the advantage in keeping the file tab-free?

I think it's better to use editor settings where tab characters are allowed
(and indent to 8-space tab stops, as is usual under Unix), but where
the editor's "indent" command (which may be the TAB key) indents four spaces.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  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