# Working on a pattern for interface-based dispatch that uses code-generation. Is this efficient?

**URL:** <https://discourse.julialang.org/t/working-on-a-pattern-for-interface-based-dispatch-that-uses-code-generation-is-this-efficient/23904>\
**Category:** Performance\
**Created:** [May 6, 2019, 10:52am UTC](https://discourse.julialang.org/t/working-on-a-pattern-for-interface-based-dispatch-that-uses-code-generation-is-this-efficient/23904 "2019-05-06T10:52:18Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![mauro3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mauro3/32/292_2.png) [@mauro3](https://discourse.julialang.org/u/mauro3)\
**Post date:** [May 6, 2019, 11:27am UTC](https://discourse.julialang.org/t/working-on-a-pattern-for-interface-based-dispatch-that-uses-code-generation-is-this-efficient/23904/3 "2019-05-06T11:27:22Z")

</div>

x-ref to a recent thread: [Eval cannot be used in a generated function - #11 by schlichtanders](https://discourse.julialang.org/t/eval-cannot-be-used-in-a-generated-function/23630/11). TL;DR: you probably shouldn’t use `hasmethod` (or other functions depending on global state) in a generated function.

---

_[View the full topic](https://discourse.julialang.org/t/working-on-a-pattern-for-interface-based-dispatch-that-uses-code-generation-is-this-efficient/23904)._
