chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Print source after macro expansion?


From: Peter Bex
Subject: Re: [Chicken-users] Print source after macro expansion?
Date: Tue, 29 Oct 2013 12:41:19 +0100
User-agent: Mutt/1.4.2.3i

On Tue, Oct 29, 2013 at 04:36:30AM -0700, Casey Rodarmor wrote:
> On Tue, Oct 29, 2013 at 4:20 AM, Peter Bex <address@hidden> wrote:
> > Of course, another classic trick is to put a quote in front of the
> > expansion code and print the result.  This will work fine from the
> > interpreter as well:
> >
> > (define-syntax foo
> >   (syntax-rules ()
> >    ((foo) '(+ 1 1))))
> >
> > (print (foo))
> > ;; Or, to see the expression in context:
> > (print `(* ,(foo) 10))
> >
> 
> Forgive my ignorance, but wouldn't that prevent recursive macro expansion?

That's correct; it'll work for one level only.  But for quick debugging
that's often just enough.  Depending on the type of macro and the place
where you want to be debugging you can insert the quote in various
different places, or expand to something that prints some subexpressions.
But I agree, it's not very scalable.

Cheers,
Peter
-- 
http://www.more-magic.net



reply via email to

[Prev in Thread] Current Thread [Next in Thread]