From: Geoffrey Summerhayes
Subject: +debug for automated testing?
Date: 
Message-ID: <_4Yl7.27422$A24.3241157@news20.bellglobal.com>
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

From: Marco Antoniotti
Subject: Re: +debug for automated testing?
Date: 
Message-ID: <y6cd753ulj3.fsf@octagon.mrl.nyu.edu>
"Geoffrey Summerhayes" <·············@hNoOtSmPAaMil.com> writes:

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

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'.
From: Geoff Summerhayes
Subject: Re: +debug for automated testing?
Date: 
Message-ID: <tphp6q5g2ev5e6@corp.supernews.com>
"Marco Antoniotti" <·······@cs.nyu.edu> wrote in message
····················@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
From: Marco Antoniotti
Subject: Re: +debug for automated testing?
Date: 
Message-ID: <y6cae06vo0c.fsf@octagon.mrl.nyu.edu>
"Geoff Summerhayes" <·············@hNoOtSmPaAiMl.com> writes:

> "Marco Antoniotti" <·······@cs.nyu.edu> wrote in message
> ····················@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.

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.

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'.
From: Christophe Rhodes
Subject: Re: +debug for automated testing?
Date: 
Message-ID: <sqheucw86t.fsf@lambda.jesus.cam.ac.uk>
Marco Antoniotti <·······@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)