I opened an issue for this: https://github.com/JuliaLang/julia/issues/18071
You can use anonymous functions as a workaround if you are julia 0.5 only (on julia 0.4 they would be slow). From: [email protected] [mailto:[email protected]] On Behalf Of Andre Manoel Sent: Tuesday, August 16, 2016 1:38 PM To: julia-users <[email protected]> Subject: [julia-users] Method definition overwritten Hello! I've been trying out Julia 0.5-rc1, and noticed one aspect in which it behaves differently from 0.4. If I do function f(x) if x > 0 g(x) = x else g(x) = -x end return g(x) end I get the following warning WARNING: Method definition in module Main at REPL[1]:3 overwritten at REPL[1]:5. and in fact, g(x) ends up being always -x, that is, a single function g is defined in compile time following the last definition inside f. Is that behavior expected? I remember doing the same in Julia 0.4 and getting different g's depending on the value of x. What's the best way of dealing with this? Thanks! Andre
