[m-dev.] for review: implement more compare/unify of builtins for MLDS

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Nov 15 03:22:57 AEDT 2000


On 14-Nov-2000, Peter Ross <peter.ross at miscrit.be> wrote:
> For Fergus to review.

That looks fine.  Just a couple of minor comments below.

> I have no idea about the correctness of my changes, I just tried to find
> out what the equivalent code in the LLDS backend did and port it across.
...
> +
> +		/* XXX this is what std_util does */
> +	comp = MR_compare_type_info((MR_TypeInfo) x, (MR_TypeInfo) y);
> +
> +	if (comp == MR_COMPARE_EQUAL) {
> +		return TRUE;
> +	} else {
> +		return FALSE;
> +	}
>  }

The "XXX" in the comment is not necessary.  That code is fine.

But you could write the last five lines more concisely:

	return (comp == MR_COMPARE_EQUAL);

>  bool
> @@ -484,7 +486,15 @@
>  	MR_Mercury_Type_Info type_info,
>  	MR_Mercury_Type_Info x, MR_Mercury_Type_Info y)
>  {
> -	SORRY("unify for type_info");
> +	int             comp;
> +
> +	comp = MR_compare_type_info((MR_TypeInfo) x, (MR_TypeInfo) y);
> +
> +	if (comp == MR_COMPARE_EQUAL) {
> +		return TRUE;
> +	} else {
> +		return FALSE;
> +	}
>  }

Likewise here.

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