[m-dev.] for review: polymorphic ground insts

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Feb 22 03:26:17 AEDT 2000


On 21-Feb-2000, David Overton <dmo at ender.cs.mu.oz.au> wrote:
> --- ./mercury/compiler/inst_match.m	Fri Feb 11 10:45:00 2000
> +++ .././mercury/compiler/inst_match.m	Fri Feb 18 13:03:36 2000
...
> +	% Update the inst_var_sub that is computed by inst_matches_initial.
> +	% The inst_var_sub records what inst should be substituted for each
> +	% inst_var that occurs in the called procedure's argument modes.
>  :- pred update_inst_var_sub(inst_var, inst, module_info, module_info,
>  		inst_var_sub, inst_var_sub).
>  :- mode update_inst_var_sub(in, in, in, out, in, out) is semidet.
>  
> -update_inst_var_sub(V, InstA, ModuleInfo0, ModuleInfo, Sub0, Sub) :-
> -	( map__search(Sub0, V, InstB) ->
> +update_inst_var_sub(InstVar, InstA, ModuleInfo0, ModuleInfo, Sub0, Sub) :-
> +	( map__search(Sub0, InstVar, InstB) ->
> +		% If InstVar already has an inst associated with it,
> +		% merge the old inst and the new inst.  Fail is this merge
> +		% is not possible.
>  		inst_merge(InstA, InstB, ModuleInfo0, Inst, ModuleInfo),

s/is this/if this/

Ideally, a description of when this predicate is supposed to fail would be
included in the the interface documentation for this predicate, rather than
just in the comments in the predicate's implementation.

[... to be continued ...]

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