FluxML / MacroTools.jl

MacroTools provides a library of tools for working with Julia code and expressions.
https://fluxml.ai/MacroTools.jl/stable/
Other
311 stars 79 forks source link

Fix linenumbers when using @q with macro calls #108

Closed cstjean closed 4 years ago

cstjean commented 5 years ago

Fix #107 by replacing the :macrocall line-number argument with nothing. I haven't read anywhere that this is Acceptable, but it seems to work.

MikeInnes commented 5 years ago

Do you have a case where the current behaviour is a problem? I'm a bit wary of this given that macros are probably not expecting it in general.

cstjean commented 5 years ago

I @macroexpand1 a macro call that expands into other macro calls, and the line numbers are an eyesore.

I'm a bit wary of this given that macros are probably not expecting it in general.

Yeah, that's reasonable. We can leave the PR open until a more compelling use case comes up.

Gnimuc commented 5 years ago

I also hit this a while ago: https://stackoverflow.com/questions/53274001

It looks currently there is no elegant solution to strip line-number-node in macrocalls.

cstjean commented 5 years ago

FWIW, Jameson said on Slack that accepting nothing was intentional; “be liberal in what you accept, conservative in what you produce”.

EDIT: uh, that quote doesn't work in this PR's favor, does it.