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

anonymous functions are inconsistent when defined inside if #42988

Closed
jonso99 opened this issue Nov 7, 2021 · 1 comment
Closed

anonymous functions are inconsistent when defined inside if #42988

jonso99 opened this issue Nov 7, 2021 · 1 comment

Comments

@jonso99
Copy link

jonso99 commented Nov 7, 2021

I am running 1.63 on intel mac and 1.7 beta on M1 mac. both have this. Julia is inconsistent in how it creates anonymous functions with an if statement. If I create one outside of a function it respects the if, but not inside.

here is output that should be the same
julia> f3()
f2
julia> fff()
f1

and the code

function f1()
    println("f1")
end
function f2()
    println("f2")
end
f3=function()
    if 1==1
        ff()=f1()
    end
    if 1==2
        ff()=f2()
    end
    ff()
end
if 1==1
    fff()=f1()
end
if 1==2
    fff()=f2()
end
fff()
f3()
@giordano
Copy link
Contributor

giordano commented Nov 7, 2021

Duplicate of #15602

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