[plt-scheme] Where is macroexpand in PLT Scheme?

From: Bill Clementson (bill_clementson at yahoo.com)
Date: Mon Nov 10 23:31:17 EST 2003

I wanted to expand a macro in Scheme today. I had a
look for "macroexpand" in R5RS and the PLT
documenation. Didn't find it. At least, not in R5RS.
In PLT Scheme, the following code seems to be roughly
equivalent to macroexpand:

(syntax-object->datum (expand-to-top-form '(some-macro
some-params)))

Seems odd that there isn't some more convenient way to
do a macro expansion. 

Also, I came up with the following questions:

1. Is the "(syntax-object->datum (expand-to-top-form"
approach what everyone uses to expand macros? It seems
like there would be a "macroexpand" (or equivalent) as
a standard extension in different Scheme
implementations (yes, I know how to create a
macroexpand macro if I want one).
2. What are some things that people do with a syntax
object (e.g. -- the thing you get when you do an
expand or expand-to-top-form)? They seem like
interesting things for introspection; however, what
are some good examples of how they are used?
3. Why isn't some form of macroexpansion provided in
DrScheme? I would think that macroexpansion is
something that students would struggle with and which
they would appreciate tool support for.

Thanks,
--
Bill Clementson

 


__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree


Posted on the users mailing list.