-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
make macro expander functions generic #8846
Comments
Using generic functions is annoying in a different way, which is that type-based dispatch might not do what you want. I'm also pretty worried about the impact on compile time from specializing and dispatching macros. The way macros are invoked, it's not really possible to avoid dispatch overhead. |
That compilation argument seems a bit specious since we actively recommend that people implement macros by just making the macro expander a wrapper around a generic function – so many macros involve calling both an anonymous function and a generic function. Regarding confusion over type dispatch, I think that macros with type signatures would only be confusing to those who are already hopelessly confused about how macros work anyway. In fact, having type annotations may help clarify things since they make it quite clear that it is the expression that is passed in, not the value (or type). |
Would this make it easier to fix #8701? |
See, e.g. http://stackoverflow.com/a/26634485/659248 for a reason why using anonymous functions for macros is annoying. Various people have expressed surprise at this when they discover it.
The text was updated successfully, but these errors were encountered: