-
Notifications
You must be signed in to change notification settings - Fork 988
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
eval-when
doesn't work under module
or library
#878
Comments
Putting these definitions inside a library or module form makes them no longer top-level forms, which makes eval-when kinda useless.
The simplest way that I know of to provide some utility functions available at both expand and run time is to put them in their own library, separate from the one that uses them in syntax transformers. |
This seems pretty counter-intuitive, as TSPL describes top-level programs as essentially the same thing as library forms:
This solves the issue, but seems to limit optimization opportunities. |
Things inside a library form are also not top-level. |
The eval-when page in CSUG gives an example of how to use
eval-when
in order to make a definition available in multiple phases:This works when put directly into a file, but doesn't work when inside of a
library
ormodule
form:Loading this causes the following error:
The code does work if the definition of
nodups?
is wrapped in ameta
keyword, but this doesn't let you use it at runtime. Is there a way to get around this? Is this the expected behavior? If so, can it be documented? If not, what is the issue? I'd be happy to help fix it if need be.The text was updated successfully, but these errors were encountered: