{"action":"opened","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/18864","repository_url":"https://api.github.com/repos/JuliaLang/julia","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/18864/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/18864/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/18864/events","html_url":"https://github.com/JuliaLang/julia/issues/18864","id":182017784,"number":18864,"title":"Method definition overwritten in control flow","user":{"login":"cedeerwe","id":11530208,"avatar_url":"https://avatars.githubusercontent.com/u/11530208?v=3","gravatar_id":"","url":"https://api.github.com/users/cedeerwe","html_url":"https://github.com/cedeerwe","followers_url":"https://api.github.com/users/cedeerwe/followers","following_url":"https://api.github.com/users/cedeerwe/following{/other_user}","gists_url":"https://api.github.com/users/cedeerwe/gists{/gist_id}","starred_url":"https://api.github.com/users/cedeerwe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cedeerwe/subscriptions","organizations_url":"https://api.github.com/users/cedeerwe/orgs","repos_url":"https://api.github.com/users/cedeerwe/repos","events_url":"https://api.github.com/users/cedeerwe/events{/privacy}","received_events_url":"https://api.github.com/users/cedeerwe/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-10-10T13:41:53Z","updated_at":"2016-10-10T13:41:53Z","closed_at":null,"body":"I upgraded my Julia to 0.5.0 and I observed the following behaviour. I created a file test.jl, which looks as follows:\r\n```\r\nfunction test(flag)\r\n  if flag\r\n    f(x) = x\r\n  else\r\n    f(x) = -x\r\n  end\r\n  return f\r\nend\r\n```\r\nIf I include the code by `include(\"test.jl\")`, I get the following warning:\r\n```\r\nWARNING: Method definition f(Any) in module Main at C:\\Users\\cedeerwe\\test.jl:3 overwritten at C:\\Users\\cedeerwe\\test.jl:5.  \r\n```\r\nThis is weird, as in any case the function `f` will be defined only once and it won't be overwritten. I did not get such a warning in Julia 0.4.5. \r\n\r\nMy question: Is this an improper way of defining functions (i.e., the warning makes sense) or only an undesirable behaviour from Julia?"}}
{"actor":{"display_login":"cedeerwe"}}