# Base.\_return\_type in generated function

**URL:** <https://discourse.julialang.org/t/base--return-type-in-generated-function/6309>\
**Category:** General Usage\
**Tags:** question\
**Created:** [October 7, 2017, 12:53pm UTC](https://discourse.julialang.org/t/base--return-type-in-generated-function/6309 "2017-10-07T12:53:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [October 7, 2017, 12:53pm UTC](https://discourse.julialang.org/t/base--return-type-in-generated-function/6309/1 "2017-10-07T12:53:14Z")

</div>

The [manual](https://docs.julialang.org/en/latest/manual/metaprogramming/#Generated-functions-1) warns against

> Interacting with the contents or methods of Core.Inference in any way.

in generated functions. Does this mean that I cannot call `Base._return_type`? What can go wrong?

Can I call a function that does the same computation for me using `Base._return_type`, but it is defined outside (and before) the generated function?

---

<div class="post-metadata">

**Author:** ![nalimilan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nalimilan/32/147_2.png) [@nalimilan](https://discourse.julialang.org/u/nalimilan)\
**Post date:** [October 7, 2017, 3:37pm UTC](https://discourse.julialang.org/t/base--return-type-in-generated-function/6309/2 "2017-10-07T15:37:25Z")

</div>

The problem is that the generation can happen at any time, so `return_type` will hardcode the state of the defined methods at an arbitrary time point. I think you can still call `return_type` from inside the generated expression, i.e. the part which will be called at runtime, since it works like a normal function.
