-
-
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
RFC: pass macro call location to macro-function #13339
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__
&meta
argument (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.jl
is 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:
&env
and&form
; but I am quite sure that this implementation is ... considerably less graceful)