-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
RFC: pass macro call location to macro-function #13339
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
Conversation
|
The fact that Clojure does this with implicit arguments is actually the most compelling argument (see what I did there?) that I've heard for doing it this way. |
and use for `@__FILE__` and `@__LINE__` macros.
4cf6919 to
eb73258
Compare
|
For kicks, I renamed the argument to |
|
Any chance we can do more with |
|
@timholy I see what you are doing here! 😄 I haven't fully grokked the If you wouldn't mind to file an issue with a small example, I'll be happy to take a look (requiring Interpolations.jl or whatever other package is fine). |
|
i think this has been resolved and can be deleted? |
|
By what? |
This PR adds an implicit
__LOCATION__&metaargument (line/file info) to all macros, automatically added in lowering for macro definitions, and in the parser for macro calls. Fixes #9577. The main goal is better Cxx/Gallium error reporting (location information for C++ string macros), but it may also be useful for macro-heavy users such as JuMP.The main downsides I know of are:
show.jlis currently commented-out for this reason, but those should be "fixable" with some string-replace hackery)Comments?
(FWIW, Clojure also accomplishes this goal using implicit macro arguments:
&envand&form; but I am quite sure that this implementation is ... considerably less graceful)