How to best add logging/debugging code?

Ross Paterson ross at soi.city.ac.uk
Fri Nov 28 12:08:36 EST 2003


On Thu, Nov 27, 2003 at 02:19:53PM +0000, Malcolm Wallace wrote:
> Apart from changing the evaluation order of expressions, trace has
> other drawbacks, noted I think by Lennart(?) but I can't remember
> exactly where.  One issue is this:
> 
> Consider an expression where the printable argument to 'trace' causes
> the evaluation of another expression which itself is defined using
> 'trace'.  The nested 'trace' outputs will appear interspersed with
> each other.  In recursive definitions this can become quite painful
> to disentangle.

Perhaps trace should be redefined:

trace msg v = foldr seq (old_trace msg v) msg


More information about the Libraries mailing list