Skip to content
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

Closed
StefanKarpinski opened this issue Oct 29, 2014 · 3 comments
Closed

make macro expander functions generic #8846

StefanKarpinski opened this issue Oct 29, 2014 · 3 comments

Comments

@StefanKarpinski
Copy link
Member

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.

@JeffBezanson
Copy link
Member

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.

@StefanKarpinski
Copy link
Member Author

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).

@mlubin
Copy link
Member

mlubin commented Oct 29, 2014

Would this make it easier to fix #8701?

JeffBezanson added a commit that referenced this issue Jan 4, 2016
fix #9627, fix #8846, fix #8701
helps #3377, but additional work is needed there
JeffBezanson added a commit that referenced this issue Jan 5, 2016
fix #9627, fix #8846, fix #8701
helps #3377, but additional work is needed there
JeffBezanson added a commit that referenced this issue Jan 5, 2016
fix #9627, fix #8846, fix #8701
helps #3377, but additional work is needed there
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants