I stumbled across a case of bad practice that resulted in an error, but I am not sure why.
function g(y) function f(x) f = x * y return f end f(y) f(y) end g(0.2)
I really should not define a variable
f within a function
f. The about code throws
ERROR: LoadError: MethodError: objects of type Float64 are not callable and points to the second call of
At that time, f is a
Float64 but why? Does that have to do with inlining? Calling
f once instead of twice within
g works out fine.