[racket] Macros as a first class objects?

From: Thomas Chust (chust at web.de)
Date: Fri Aug 13 11:09:46 EDT 2010

2010/8/13 Matthias Felleisen <matthias at ccs.neu.edu>:
> [...]
> 4. When you think about macros as syntax and when you realize that syntax no longer exists at run-time, it makes no sense whatsoever to formulate the question. It doesn't denote. {Conduct the following thought experiment: (map if '(a b) '(1 2) '(% $)) .}
> [...]


it may make sense, however, to ask for something like

  (map (syntax-transformer-of #'if) (list #'(if a 1 %) #'(if b 2 $)))

where syntax-transformer-of is some hypothetical accessor procedure
for the syntax transformer bound to the given identifier.

Which brings me to the related question whether it is actually
possible to define syntax-transformer-of in Racket? I found no way to
achieve this using dynamic-require or namespace-variable-value, since
these procedures always signal errors when accessing a binding in the
syntax phase.


When C++ is your hammer, every problem looks like your thumb.

Posted on the users mailing list.