# Eval cannot be used in a generated function

**URL:** <https://discourse.julialang.org/t/eval-cannot-be-used-in-a-generated-function/23630>\
**Category:** General Usage\
**Tags:** question\
**Created:** [April 28, 2019, 9:40pm UTC](https://discourse.julialang.org/t/eval-cannot-be-used-in-a-generated-function/23630 "2019-04-28T21:40:57Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![schlichtanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/schlichtanders/32/32145_2.png) [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Post date:** [May 1, 2019, 8:20am UTC](https://discourse.julialang.org/t/eval-cannot-be-used-in-a-generated-function/23630/11 "2019-05-01T08:20:51Z")

</div>

some extra notes:

I use this type-inference finally in a function which checks whether some function is defined for given input parameters. Think of it as `hasmethod2`, like `hasmethod` but being able to deal with forwarding `f(args...; kwargs...) = g(args...; kwargs...)`.  
This works like a charm with the created new types 😃

Okay, why do I need to have this in a generated function?  
It is because I want to do dispatch on the fact whether a function is defined or not.

---

_[View the full topic](https://discourse.julialang.org/t/eval-cannot-be-used-in-a-generated-function/23630)._
