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

macro hygiene and type parameters #27155

Closed
SimonDanisch opened this issue May 18, 2018 · 0 comments
Closed

macro hygiene and type parameters #27155

SimonDanisch opened this issue May 18, 2018 · 0 comments
Assignees
Labels
macros @macros

Comments

@SimonDanisch
Copy link
Contributor

macro test()
    quote
        const MyTest{Arg} = Tuple{Arg}
    end
end

@test # gives: syntax: invalid variable expression in "where"

expr = quote
    const MyTest{Arg} = Tuple{Arg}
end

eval(expr) # works

@mbauman figured out, that this might be a hygiene issue:

macro test()
    quote
        const MyTest{$(esc(:Arg))} = Tuple{$(esc(:Arg))}
    end
end
@test # works
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
macros @macros
Projects
None yet
Development

No branches or pull requests

3 participants