# Instantiating function from type?

**URL:** https://discourse.julialang.org/t/instantiating-function-from-type/107532
**Category:** General Usage
**Tags:** type, function
**Created:** [December 12, 2023, 10:37pm UTC](https://discourse.julialang.org/t/instantiating-function-from-type/107532 "2023-12-12T22:37:50Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![nsajko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nsajko/32/221187_2.png) [@nsajko](https://discourse.julialang.org/u/nsajko)
#### Post date: [December 12, 2023, 11:54pm UTC](https://discourse.julialang.org/t/instantiating-function-from-type/107532/4 "2023-12-12T23:54:01Z")

</div>

> [@stevengj](#):
>
> `F()` doesn’t work, but I feel like it should

Related thread:

> [@Constructors for \`\<:Function\` types when possible, like in C++](https://discourse.julialang.org/t/constructors-for-function-types-when-possible-like-in-c/86611):
>
> I was thinking about how C++20 [added](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0624r2.pdf) support for default constructors for stateless (with no captures) lambdas, meaning that nowadays all function object families may be default-constructible in C++. Then I realized that in Julia I can’t even do typeof(sqrt)(), or something like this: func(::F) where {F \<: Function} = F()(5.0) func(sqrt) # Or this func(::Type{F}) where {F \<: Function} = F()(5.0) func(typeof(sqrt)) Seems like passing “pure” functions as types, instead of as objects would make…

---

_[View the full topic](https://discourse.julialang.org/t/instantiating-function-from-type/107532)._
