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

call inactive function in while loop #56211

Closed
kulowf opened this issue Oct 17, 2024 · 1 comment
Closed

call inactive function in while loop #56211

kulowf opened this issue Oct 17, 2024 · 1 comment

Comments

@kulowf
Copy link

kulowf commented Oct 17, 2024

On Julia 1.11.0, 1.10.4, 1.9.0, Win10; Julia 1.8.3 on Ubuntu

while true   
    function f()
        @warn "active function"
    end

    f()
	
    break    
    function f()
        @warn "inactive function"  
    end
end

output of this:

Warning: inactive function

Is this a bug or a feature?

@fredrikekre
Copy link
Member

$ julia --warn-overwrite=yes -q

julia> while true
           function f()
               @warn "active function"
           end

           f()

           break
           function f()
               @warn "inactive function"
           end
       end
WARNING: Method definition f() in module Main at REPL[1]:2 overwritten at REPL[1]:9.
┌ Warning: inactive function

The method is overwritten before you call f(). See also #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

2 participants