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

Fergus Henderson fjh at
Mon Nov 3 20:53:33 CET 2003

prunesquallor at writes:

>Fergus Henderson <fjh at> writes:
>> If I have a function foo whose body invokes a macro bar which calls a
>> function baz, can I get a "stack trace" or equivalent which shows me the
>> line in the definition of bar which invokes baz, and the line in the
>> definition of foo which invokes bar?  Can I see the bindings of the
>> parameters of bar?
>(define (baz x)
>  (+ x 3))
>(define-syntax bar
>  (syntax-rules ()
>    ((bar x) (begin0 (baz x) #f))))
>(define (foo y)
>  (begin (bar y) #f))
>> (foo 'a)
>+: expects type <number> as 1st argument, given: a; other arguments were: 3
>c:\home\jrm\ (+ x 3)
>c:\home\jrm\ (begin0 (baz y) #f)
>STDIN::105: (foo (quote a))

That's still missing an entry from the stack trace.
There's no entry for the call to bar.

Fergus Henderson <fjh at>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <>  |     -- the last words of T. S. Garp.

More information about the Python-list mailing list