Eval a string with runtime defined functions

The problem is that the lexical scope slow_fn is defined in can include the global scope. For a dramatic example, consider

badfun() = local_eval("Base.(+)(a::Int, b::Int) = 1")

function f(x)
    badfun()
    return x + 1
end
f(2)
1 Like