Re: A simple debugging macro





fairchild.anthony@xxxxxxxxx wrote:
Hello all,

I wrote this simple macro a while back and I've found it to be
extremely useful for old-fashioned trace style debugging. Maybe
others will find it useful as well. Thoughts or criticism are
welcome. Perhaps others have similar macros or other methods of doing
this that are better.

Think to come of it, that would be a way kewl project, Ye Ultimate Lisp Debuggery Tools. Yer hired.

You probably want a long form and a short form, feature richer vs typer friendlier.

In my long form (TRC) if the first arg is not a string then it is a form to be evaluated at run time to determine if that output should be emitted.

SOmeone suggested allowing strings in other positions, presumably someone who just adores using the shift key and finding the " key. Nah, just do this: if the arg is a keyword, just emit it, else emit the source followed by the value. Yes, hairy forms can make for copious output, but not so often so we'll live.

Aside: recently Duane divulged the secrets of knowing where I am in the ACL source at compile-time, sadly forgotten. You could allow callers to offer :wc for "where called" and auto-emit whatever the implementation offers.

Getting back to my short form, mine takes this:

(trcx a b c)

....and expands that to the long form:

(trc "a" :b b :c c)

I am meaning to add the utterly q&d:

(trcxx yo-mama)

expanding to:

(trc "yo-mamma" yo-mama)

Meanwhile, I think one massively necessary thing you must deliver is something like my eko and ekx:


(eko ("hi there" a b) (super-form a b))

which calls the body and then before returning the result prints out the story of what result got returned along with the other stuff as if by TRC. ekx is the short form:

(ekx yo-mama super-form a b)

Lisp is this awesome functional thangy, so without EK* I have to hack the code massively with a let form or progn to capture an intermediate result and dump it. Ewwww, as the kids would say.


Due Monday.

kzo

--
http://www.theoryyalgebra.com/

"In the morning, hear the Way;
in the evening, die content!"
-- Confucius
.