This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: order of macro expansion
On 02/28/2012 12:30 AM, Max Kirillov wrote:
Hello.
I would like to know if there is a way to manage (or at least predict)
macros expansion. For example, I have the following code:
---------------
; this expands to a sequence of "define-alias" calls
(imports
....
("android.graphics" (Bitmap Paint Canvas)))
I think I need to see the definition of the imports macro.
This is going to be a little tricky because it involves
creating an identifier from a string and a symbol.
You probably need to use define-syntax and syntax-case, along with
datum->syntax and (possibly) syntax->datum, BTW, to get the proper
hygiene bindings.
Here, the aliased in macro classes are not visible in field
declarations. I suppose this happens because it compiles
"define-simple-class" before fully expanding "imports". I could also
remember several other cases where I had similar problems.
Top-level syntax forms are expanded in order, whether they are
user macros or builtins.
My guess (without having seen your code) is a problem with macro hygiene.
--
--Per Bothner
per@bothner.com http://per.bothner.com/