Paging Mr. Rettig [ws Re: Explanation of macros; Haskell macros]

Duane Rettig duane at franz.com
Sun Nov 2 10:33:11 EST 2003


james anderson <james.anderson at setf.de> writes:

> Marcin 'Qrczak' Kowalczyk wrote:
> > 
> > On Sun, 02 Nov 2003 02:01:58 -0800, Duane Rettig wrote:
> > 
> > > With this much openness, it doesn't seem unreasonable
> > > to expect a debugger to be able to use such information to make macros
> > > and the forms they expand into completely debuggable and steppable at
> > > any desired level.
> > 
> > Does any debugger do this?
> 
> ? you mean like this? wrt evaluating
> 
> (defun testf (x)
>   (dotimes (i x)
>     (print i)))
> 
> (step (testf 2))

I've reproduced the whole code below so that readers can see it
when they contemplate this comment and a question (I have no time
now, but I'll explain tonight if nobody gets it, although it should
be easy):  James did not say what lisp he was using, but presumably
it is a Common Lisp.  The following example was obviously not
compiled.  Can you explain why?

> ==>
> 
> (testf 2)
>   (block testf (dotimes (i x) (print i)))
>     (dotimes (i x) (print i))
>       x = 2
>       (block nil (if (ccl::int>0-p #:g25) (tagbody #:g24 (print i) (locally #
> #) (unless # #))) nil)
>         (if (ccl::int>0-p #:g25) (tagbody #:g24 (print i) (locally (declare #)
> (setq i #)) (unless (eql i #:g25) (go #:g24))))
>           (ccl::int>0-p #:g25)
>             #:g25 = 2
>           t
>           (tagbody #:g24 (print i) (locally (declare (ccl::settable i)) (setq
> i (1+ i))) (unless (eql i #:g25) (go #:g24)))
>             (print i)
>               i = 0
>             0
>             (locally (declare (ccl::settable i)) (setq i (1+ i)))
>               (setq i (1+ i))
>                 (1+ i)
>                   i = 0
>                 1
>               1
>             1
>             (unless (eql i #:g25) (go #:g24))
>               (not (eql i #:g25))
>                 (eql i #:g25)
>                   i = 1
>                   #:g25 = 2
>                 nil
>               t
>               (progn (go #:g24))
>                 (go #:g24)
>             (print i)
>               i = 1
>             1
>             (locally (declare (ccl::settable i)) (setq i (1+ i)))
>               (setq i (1+ i))
>                 (1+ i)
>                   i = 1
>                 2
>               2
>             2
>             (unless (eql i #:g25) (go #:g24))
>               (not (eql i #:g25))
>                 (eql i #:g25)
>                   i = 2
>                   #:g25 = 2
>                 t
>               nil
>             nil
>           nil
>         nil
>       nil
>     nil
>   nil
> nil
> 
> 
> v/s
> 
> (testf 2)
>   (block testf (dotimes (i x) (print i)))
>     (dotimes (i x) (print i))
>     nil
>   nil
> nil
> 
> 
> depending on whether one stepped into or over the macro form?

-- 
Duane Rettig    duane at franz.com    Franz Inc.  http://www.franz.com/
555 12th St., Suite 1450               http://www.555citycenter.com/
Oakland, Ca. 94607        Phone: (510) 452-2000; Fax: (510) 452-0182   




More information about the Python-list mailing list