[plt-scheme] Recognizing datums in macros

From: Jim Blandy (jimb at red-bean.com)
Date: Tue Feb 7 18:29:38 EST 2006

On 2/7/06, Jens Axel Søgaard <jensaxel at soegaard.net> wrote:
> Is there a way to signal an error if datum is not a datum?

The transformer is ordinary code, so you could simply check whether it
was syntax representing an s-expression that evaluates to itself, or a
well-formed quote expression.

I think you'd need to use free-identifier=? to check that you're
getting the global 'quote', and not something lambda-bound, but I've
never been really confident of the distinction between
free-identifier=? and bound-identifier=?.

(Please, nobody repeat the docs and the publications to me about how
one is for identifiers appearing as free variables in the expansion,
since it's not known at expansion time blah blah blah.  I've read them
a dozen times, and I just don't get it.  I think hygienic macros are
manifestly The Wrong Thing, simply because they're so hard to explain.
 Even Matthias answers questions about them incorrectly from time to
time --- QED.)


Posted on the users mailing list.