[m-dev.] for review: clean up declarative debugger

Fergus Henderson fjh at cs.mu.OZ.AU
Mon Apr 26 12:41:02 AEST 1999


On 26-Apr-1999, Mark Anthony BROWN <dougl at cs.mu.OZ.AU> wrote:
> +:- instance evaluation_tree(mercury_edt) where [
> +	pred(edt_root/2) is mercury_edt_root,
> +	pred(edt_children/2) is mercury_edt_children
> +].
> +
> +:- type mercury_edt == c_pointer.

You should use a no-tag type rather than an equivalence type:

	:- type mercury_edt ---> mercury_edt(c_pointer).

Otherwise the instance declaration will apply to any c_pointer...

> +:- type declarative_bug(T)		% <= evaluation_tree(T)
> +	--->	not_found
> +			%
> +			% An EDT whose root node is erroneous but
> +			% all children are correct.
> +			%
> +	;	e_bug(T).

It took me a while to realize that the comment was supposed to apply
to e_bug/1 rather than to not_found/0.  I suggest changing the layout
(e.g. by adding a blank line after `not_found', and perhaps unindenting
the comment one tab) and/or clarifying the comment.

> diff -u -r1.1 declarative_oracle.m
> --- declarative_oracle.m	1999/04/12 04:11:42	1.1
> +++ declarative_oracle.m	1999/04/25 17:04:00
> @@ -18,17 +18,32 @@
>  :- import_module declarative_debugger.
>  
>  	%
> +	% The oracle database.  This is threaded around the declarative
> +	% debugger, but currently stores no information.
> +	%
> +:- type oracle_data.
> +
> +	%
>  	% Query the oracle about the program being debugged.  The first
>  	% argument is a node in the evaluation tree, the second argument
> -	% is its validity in the intended interpreation.
> +	% is its validity in the intended interpretation.
> +	%
> +:- pred query_oracle(edt_node, edt_truth, oracle_data, oracle_data,
> +		io__state, io__state).
> +:- mode query_oracle(in, out, in, out, di, uo) is det.
> +
> +	%
> +	% Produce a new oracle state.
>  	%
> -:- pred query_oracle(edt_node, bool, io__state, io__state).
> -:- mode query_oracle(in, out, di, uo) is det.
> +:- pred oracle_data_init(oracle_data).
> +:- mode oracle_data_init(out) is det.

You might want to consider making that interface a typeclass too.


Apart from the points noted above, that change looks fine.

Cheers,
	Fergus.

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