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

Fergus Henderson fjh at cs.mu.oz.au
Mon Nov 3 20:53:33 CET 2003


prunesquallor at comcast.net writes:

>Fergus Henderson <fjh at cs.mu.oz.au> 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\test.ss:3:2: (+ x 3)
>c:\home\jrm\test.ss:10:9: (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 cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.




More information about the Python-list mailing list