# A method to remove the use of runtime eval and invokelatest, as well as support closures in generated functions! Come with an implemented proptype

**URL:** <https://discourse.julialang.org/t/a-method-to-remove-the-use-of-runtime-eval-and-invokelatest-as-well-as-support-closures-in-generated-functions-come-with-an-implemented-proptype/27450>\
**Category:** Package Announcements\
**Tags:** metaprogramming\
**Created:** [August 12, 2019, 11:26am UTC](https://discourse.julialang.org/t/a-method-to-remove-the-use-of-runtime-eval-and-invokelatest-as-well-as-support-closures-in-generated-functions-come-with-an-implemented-proptype/27450 "2019-08-12T11:26:10Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![cscherrer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cscherrer/32/7631_2.png) [@cscherrer](https://discourse.julialang.org/u/cscherrer)\
**Post date:** [August 12, 2019, 3:11pm UTC](https://discourse.julialang.org/t/a-method-to-remove-the-use-of-runtime-eval-and-invokelatest-as-well-as-support-closures-in-generated-functions-come-with-an-implemented-proptype/27450/4 "2019-08-12T15:11:08Z")

</div>

@thautwarm is being kind in using “we” a lot in her description of the solution, so I think some context is helpful.

I’ve struggled with the right way to get around `eval`/`invokelatest` since very early in my work on `Soss` (first commit December 2017). At JuliaCon 2019 I learned the several others were facing this same problem, as discussed [here](https://discourse.julialang.org/t/codegen-woes/27098/8).

@mohamed82008 had previously suggested to me to encode my entire model in the type in order to use generated functions, but I couldn’t quite figure out how to get it to work. And @jpfairbanks had a similar suggestion for encoding algebraic manipulations as types. [We had been joking around and I thought he was trolling me, but now it doesn’t seem so infeasible].

Anyway, even if generated functions had supported closures from the beginning, it wouldn’t have been clear to me how to take advantage of this. So the detailed write-up above is really helpful. Really, my part in GG.jl so far has been to provide an interesting problem to work on 🙂

---

_[View the full topic](https://discourse.julialang.org/t/a-method-to-remove-the-use-of-runtime-eval-and-invokelatest-as-well-as-support-closures-in-generated-functions-come-with-an-implemented-proptype/27450)._
