[m-dev.] for review: write abstract instances to .int files

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Dec 2 16:19:46 AEDT 1999


This change looks good.
I have a couple of suggestions about the documentation.

On 02-Dec-1999, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
> 
> diff -u -u -r1.112 modules.m
> --- modules.m	1999/11/23 02:37:54	1.112
> +++ modules.m	1999/12/01 05:15:18
> @@ -3993,7 +4003,12 @@
>  		InInterface1 = no
>  	;
>  		( InInterface0 = yes ->
> -			Items1 = [Item - Context | Items0]
> +			( make_abstract_instance(Item, Item1) ->
> +				ItemToWrite = Item1
> +			;
> +				ItemToWrite = Item
> +			),
> +			Items1 = [ItemToWrite - Context | Items0]
>  		;
>  			Items1 = Items0
>  		),

I think it would be a good idea to change the comment for `get_interface'
to reflect that change, i.e. mention that it strips out the bodies
of instance definitions.

> +:- pred make_abstract_instance(item, item).
> +:- mode make_abstract_instance(in, out) is semidet.
> +
> +make_abstract_instance(Item, Item1) :-
> +	Item = instance(Constraints, Class, ClassTypes, Body0, TVarSet),
> +	Body0 = concrete(_),
> +
> +	%
> +	% All instance declarations must be written
> +	% to `.int' files as abstract instance
> +	% declarations because the method names
> +	% have not yet been module qualified.
> +	% This could cause the wrong predicate to be
> +	% used if calls to the method are specialized.
> +	%
> +	Body = abstract,
> +	Item1 = instance(Constraints, Class, ClassTypes, Body, TVarSet).

I think it would be a little clearer if the comment preceded
the code here, rather than being interspersed in the middle.

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