# Eval a string with runtime defined functions

**URL:** <https://discourse.julialang.org/t/eval-a-string-with-runtime-defined-functions/111290>\
**Category:** General Usage\
**Created:** [March 7, 2024, 12:32pm UTC](https://discourse.julialang.org/t/eval-a-string-with-runtime-defined-functions/111290 "2024-03-07T12:32:07Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)\
**Post date:** [March 8, 2024, 4:10am UTC](https://discourse.julialang.org/t/eval-a-string-with-runtime-defined-functions/111290/11 "2024-03-08T04:10:57Z")

</div>

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

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

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

```

---

_[View the full topic](https://discourse.julialang.org/t/eval-a-string-with-runtime-defined-functions/111290)._
