[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] About define-syntax and expansion environment
From: |
Peter Bex |
Subject: |
Re: [Chicken-users] About define-syntax and expansion environment |
Date: |
Fri, 14 Jun 2013 16:56:49 +0200 |
User-agent: |
Mutt/1.4.2.3i |
On Fri, Jun 14, 2013 at 10:30:28PM +0800, Xin Wang wrote:
> Hi,
>
> I encountered a problem that previously defined macro can not be used
> inside other macro defination.
>
> It seems that newly defined syntax does not available in macro expansion
> environment, is it intended?
That's correct; this problem is known as "phasing"; macros are defined in
their own compilation phase. Each phase can only see macros defined in
earlier phases.
To define a macro for the macro environment, you can wrap it in a
begin-for-syntax block, or put it inside its own module and then
use import-for-syntax to import it in the module that uses it.
Cheers,
Peter
--
http://www.more-magic.net