Paging Mr. Rettig [ws Re: Explanation of macros; Haskellmacros]
prunesquallor at comcast.net
prunesquallor at comcast.net
Mon Nov 3 12:58:46 EST 2003
Fergus Henderson <fjh at cs.mu.oz.au> writes:
> prunesquallor at comcast.net writes:
>
>>Duane Rettig <duane at franz.com> writes:
>>
>>> Marcin 'Qrczak' Kowalczyk <qrczak at knm.org.pl> writes:
>>>
>>>> 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?
>>>
>>> Most Lisp debuggers will do this with compiled code. I know of none which
>>> do this to compiled code without recompilation.
>>
>>MIT Scheme (which we all know is not Common Lisp) keeps around enough
>>debug information to determine the source code being executed at each
>>step in the compiled code. I don't recall if there is a compiled code
>>stepper per se, but crawling down the stack in compiled code shows the
>>source code that was being evaluated.
>
> Including macros invocations?
I don't think MIT Scheme tracks macro expansions.
However, PLT Scheme does. The compiler and macroexpander are
orthogonal, so in principle one could simply merge the two methods.
> When you say "source code", do you really mean source code, or do
> you mean the results of macro-expansion?
In PLT Scheme I really mean the source code.
> 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))
More information about the Python-list
mailing list