[plt-scheme] macro keyword conflicting with other imports?
From: ian barland (penguin flight instructor) (ian at cs.rice.edu)
Date: Wed Nov 10 17:56:48 EST 2004 |
|
Matthew writes:
>
>> (syntax-rules (fun)
>> ...
> The `fun' literal above matches identifiers with the same binding for
> `fun' as the context of the literal.
>
Wow, this is a more refined sense of matching than
I ever suspected. Neat! (Um, I think.)
Now I understand why cond's `=>' only works when `=>' hasn't been rebound.
Matthias writes:
>
> Export fun as a keyword that blows up when used in an improper context.
>
Not sure if this is what you meant, but:
I made `fun' a syntax-id-rules with no clauses, so it always blows up,
except when it occurs inside the intended macro which preemptively
transforms it away.
But this way I'm able to export `fun', so that other people trying to
multiply-import the keyword will get a plausible error message.
...Still, seems like an awfully odd contortion!
It's clear to me, I don't fully understand this Hygiene thing;
Am off to look up the Dybvig paper referenced in help-desk...
Thanks for the help,
--ian