Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

+debug for automated testing?

1 view
Skip to first unread message

Geoffrey Summerhayes

unread,
Sep 7, 2001, 12:30:33 AM9/7/01
to
Is it reasonable practice to write:

(defun func1
...
+debug-func1 (format *debug-io* ...)
...
+debug-func1 (unless (= ans (func2...) (error ...))
)

+debug-func1 (defun func2...)

(let ((*features* (cons :debug-func1 *features*)))
(load ...))

or is there a more common way of handling something
like this?

Geoff


Marco Antoniotti

unread,
Sep 7, 2001, 10:24:00 AM9/7/01
to

"Geoffrey Summerhayes" <sNuOmS...@hNoOtSmPAaMil.com> writes:

I do this. Then I usually get to the point where I get so annoyed by
myslef that I end up writing something like

(defvar *my-package-debug-flag* t)

(defun my-package-debug-msg (msg &rest args)
(when *my-package-debug-flag*
(apply #'format *trace-io* msg args)))

You can vary all of this as you like (add a `debug level', specify a
`log-stream', whatever). I just feel that once you project gets
beyond a certain size, it is better to have a centralized place to do
these things.

Cheers


--
Marco Antoniotti ========================================================
NYU Courant Bioinformatics Group tel. +1 - 212 - 998 3488
719 Broadway 12th Floor fax +1 - 212 - 995 4122
New York, NY 10003, USA http://bioinformatics.cat.nyu.edu
"Hello New York! We'll do what we can!"
Bill Murray in `Ghostbusters'.

Geoff Summerhayes

unread,
Sep 7, 2001, 11:24:10 AM9/7/01
to

"Marco Antoniotti" <mar...@cs.nyu.edu> wrote in message
news:y6cd753...@octagon.mrl.nyu.edu...

>
>
> I do this. Then I usually get to the point where I get so annoyed by
> myslef that I end up writing something like
>
> (defvar *my-package-debug-flag* t)
>
> (defun my-package-debug-msg (msg &rest args)
> (when *my-package-debug-flag*
> (apply #'format *trace-io* msg args)))
>
> You can vary all of this as you like (add a `debug level', specify a
> `log-stream', whatever). I just feel that once you project gets
> beyond a certain size, it is better to have a centralized place to do
> these things.
>

I like this idea better. As opposed to "don't ship debug code" it
becomes "ship with the debug code turned off" which is probably
better in terms of future maintenance. I think I'll add both
to my toolbox, and choose between them based on actual requirements.

Thanks,
Geoff

Marco Antoniotti

unread,
Sep 7, 2001, 2:45:07 PM9/7/01
to

"Geoff Summerhayes" <sNuOmS...@hNoOtSmPaAiMl.com> writes:

As it should be.

Just to elaborate a little further. Often I conditionalize code out
by using things like #+ignore or #+this-is-disgusting (I will save
you all the Italian colorful variants :) ).

The problem with this approach is that I eventually forget all the
#+xxx variants I use and have to look for them individually. Not too
much work, you may say, but still work nevertheless.

I kind of like the idea of some *simple* and common API for debugging
messages. Maybe it will be worthwhile looking into it a little more
seriously.

Christophe Rhodes

unread,
Sep 9, 2001, 2:06:02 PM9/9/01
to
Marco Antoniotti <mar...@cs.nyu.edu> writes:

> I kind of like the idea of some *simple* and common API for debugging
> messages. Maybe it will be worthwhile looking into it a little more
> seriously.

Mmm, please do :)

I'm sure that if anyone posts an idea here its merits will soon be
evident and its shortcomings displayed...

Lisp RFCs, anyone?

Christophe
--
Jesus College, Cambridge, CB5 8BL +44 1223 510 299
http://www-jcsu.jesus.cam.ac.uk/~csr21/ (defun pling-dollar
(str schar arg) (first (last +))) (make-dispatch-macro-character #\! t)
(set-dispatch-macro-character #\! #\$ #'pling-dollar)

0 new messages