You’re experiencing https://docs.julialang.org/en/latest/manual/methods.html#Redefining-Methods-1 which is a breaking change in Julia v0.6. This change was made to avoid a long-standing issue in Julia in which newly-defined functions sometimes wouldn’t take effect: https://github.com/julialang/julia/issues/265 Julia v0.6 is stricter (which is annoying in your particular case) but also more correct (which is better in all cases).
It might be worth considering whether you really need to be defining a function with eval(). There may be an alternative that doesn’t require jumping through these hoops.