Ah, cool! I see they have been discussing it here as well: https://github.com/JuliaLang/julia/issues/15602 That's a bit inconvenient, but I can see the point...
Thanks for the answer :-) Le mardi 16 août 2016 22:27:41 UTC, David Anthoff a écrit : > > 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] <javascript:> [mailto: > [email protected] <javascript:>] *On Behalf Of *Andre Manoel > *Sent:* Tuesday, August 16, 2016 1:38 PM > *To:* julia-users <[email protected] <javascript:>> > *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 >
