# Getting the type of \`f(x)\` at compile time (without evaluating \`f(x)\`), for type-stable functions

**URL:** <https://discourse.julialang.org/t/getting-the-type-of-f-x-at-compile-time-without-evaluating-f-x-for-type-stable-functions/16069>\
**Category:** General Usage\
**Tags:** question\
**Created:** [October 9, 2018, 12:45pm UTC](https://discourse.julialang.org/t/getting-the-type-of-f-x-at-compile-time-without-evaluating-f-x-for-type-stable-functions/16069 "2018-10-09T12:45:54Z")\
**Posts on this page:** 1\
**Showing post:** 4

<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 9, 2018, 1:14pm UTC](https://discourse.julialang.org/t/getting-the-type-of-f-x-at-compile-time-without-evaluating-f-x-for-type-stable-functions/16069/4 "2018-10-09T13:14:59Z")

</div>

> [@MikeInnes](#):
>
> If there’s _any_ other way to do what you want it’s probably a good idea.

I second this. These “other ways” are documented mostly in the source of Julia and the standard libraries though. A more specific question would allow suggesting the right one.

Eg if you are collecting things, I would recommend you look at the functions `collect` calls, or [a functional approach](https://discourse.julialang.org/t/functional-implementation-of-collect/15177) I experimented with.

---

_[View the full topic](https://discourse.julialang.org/t/getting-the-type-of-f-x-at-compile-time-without-evaluating-f-x-for-type-stable-functions/16069)._
