[m-dev.] For review: Improve debugging printout under Prolog

Fergus Henderson fjh at cs.mu.oz.au
Tue Oct 28 18:39:36 AEDT 1997


Peter Schachte, you wrote:
> Improve debugging printout under Prolog
> +%  argument to hide, or it mmay be the atom 'term', in which case only the

s/mmay/may/

> +show_term_args(Name, Arity, Args) :-
> +	(   retract(hidden(Name, Arity, OldHidden0)),
> +	    (   Args == term ->
> +		    true
> +	    ;   sort(Args, Args1),
> +		(   OldHidden0 = term ->
> +			iota(255, OldHidden)
> +		;   OldHidden = OldHidden0
> +		),
> +		sorted_list_difference(OldHidden, Args1, NewHidden),
> +		assertz(hidden(Name, Arity, NewHidden))
> +	    ),
> +	    fail
> +	;   true
> +	).

Inconsistent indentation -- the `else' part should be at the
same indentation level as the `then' part, not the condition.

> +hidden(Spec, Args) :-
> +	Spec = Name/Arity,
> +	hidden(Name, Arity, Args),
> +	(   var(Arity) ->
> +		Arity = (all)
> +	;   true
>  	).

Ditto.

> +* Controlling Printout:: Controlling printout of large terms during debugging

s/Printout/printout/

Also change the second occurrence of "printout" to "display".

> +See @ref{Controlling Printout} for more information on controlling the

s/Printout/printout/

> + at node Controlling Printout
> + at section Controlling Printout of large terms

s/Printout/printout/

Also you should avoid the name `iota' -- that is a builtin in NU-Prolog.
And the call to iota/2 looks like a bug
(which would have been caught by static type checking, incidentally).

Apart from that, it looks OK, but I didn't examine it too closely, and
the iota/{2,3} bug suggests that maybe it has not been sufficiently tested.

So please fix the above and test it some more.

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



More information about the developers mailing list