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 problem with closures #4771

Closed
toivoh opened this issue Nov 10, 2013 · 3 comments
Closed

Macro hygiene problem with closures #4771

toivoh opened this issue Nov 10, 2013 · 3 comments
Assignees

Comments

@toivoh
Copy link
Contributor

toivoh commented Nov 10, 2013

With the latest julia, the following code

module Lib
export @make_closure
macro make_closure()
    quote       
        f = (x)->1
    end
end
end # module

module Test
using Lib
@make_closure
end # module

gives me

ERROR: syntax: malformed function arguments (. #<julia: Lib> 'x)
 in include at boot.jl:238
at /home/toivo/code/julia/juliastuff/issues/closure-hygiene/test.jl:15

With julia Commit ba9d7e5* 2013-10-15 15:00:57 UTC it works fine. It seems that macro hygienization believes that the argument x in (x)->1 is a global variable. This also seems to be the cause of toivoh/PatternDispatch.jl#17.

@ViralBShah
Copy link
Member

@JeffBezanson Does this hold back 0.2?

@ViralBShah
Copy link
Member

This is also seems like something we should have a test for.

@toivoh
Copy link
Contributor Author

toivoh commented Nov 10, 2013

Thanks!

JeffBezanson added a commit that referenced this issue Nov 21, 2013
unfortunately I botched the fix for #4771, which led to this problem
JeffBezanson added a commit that referenced this issue Nov 30, 2013
unfortunately I botched the fix for #4771, which led to this problem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants