[mercury-users] Newbie problem. :)

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Jul 13 14:43:20 AEST 1999


On 18-Jun-1999, Richard A. O'Keefe <ok at atlas.otago.ac.nz> wrote:
> [...] the *only* maintenance difference between
> 
>     (  singular(X) -> ...
>     ;  positive_definite(X) -> ...
>     )
> 
> and
> 
>     :- singular(X), positive_definite(X).
>     ...
>     (   singular(X), ...
>     ;   positive_definite(X), ...
>     )
> 
> is that in the version with the negative rule, the crucial information
> is written *SOMEWHERE*, while in the present state of affairs it is
> written *NOWHERE*.  

I can see at least one additional difference.  In the present state of
affairs, if the code in question has a bug, then it will either be in
that clause itself, or in the code for the procedures that it calls
(singular/1 or positive_definite/1).  In the version with the negative
clause, the bug could be in the negative clause, which is not
explicitly called.

This does have some implications for the kinds of debugging strategies
that you can use.  In particular, it might make it difficult to debug
programs without recompiling them with extra debugging checks enabled.

When you are tracing through the program, either the implementation should
automatically detect errors in negative clauses, as you suggested, or
alternatively the debugger should at least step into the negative clause
to show the programmer that the program's behaviour depends on it.
The trouble with the former approach is that it is very difficult to
implement in a way that has little run-time overhead in the case where
debugging is not enabled.  The trouble with the latter approach is just
that it would probably be fairly difficult to implement.

This issue is not necessarily a fatal flaw, but it is certainly a drawback.

-- 
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-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list