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

defining empty function with escaped name in macro does not work #38386

Closed
mhinsch opened this issue Nov 11, 2020 · 0 comments · Fixed by #38402
Closed

defining empty function with escaped name in macro does not work #38386

mhinsch opened this issue Nov 11, 2020 · 0 comments · Fixed by #38402
Assignees
Labels
bug Indicates an unexpected problem or unintended behavior macros @macros

Comments

@mhinsch
Copy link

mhinsch commented Nov 11, 2020

When I try to define an empty generic function from within a macro using an escaped name I get a 'malformed expression' error. Doing exactly the same thing but with a function with an empty argument list works.

julia> macro Bla()
       fname = :myfun
       :(function $(esc(fname)) end)
       end
@Bla (macro with 1 method)

julia> @Bla
ERROR: syntax: malformed expression
Stacktrace:
 [1] top-level scope at REPL[8]:1

julia> macro Bla()
       fname = :myfun
       :(function $(esc(fname))() end)
       end
@Bla (macro with 1 method)

julia> @Bla
myfun (generic function with 1 method)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior macros @macros
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants