# Function as argument

**URL:** <https://discourse.julialang.org/t/function-as-argument/106385>\
**Category:** General Usage\
**Tags:** question\
**Created:** [November 17, 2023, 7:31pm UTC](https://discourse.julialang.org/t/function-as-argument/106385 "2023-11-17T19:31:45Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![Benny](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Benny](https://discourse.julialang.org/u/Benny)\
**Post date:** [November 18, 2023, 1:47am UTC](https://discourse.julialang.org/t/function-as-argument/106385/8 "2023-11-18T01:47:55Z")

</div>

> [@lrnv](#):
>
> in the OP state of the code, the inner method indeed specializes on the function, but the outer one does not

Correct. Reminds me of a [past thread](https://discourse.julialang.org/t/performance-issue-due-to-function-as-an-argument/104093/10); TLDR yes this exception is unintuitive, but specializing on functions by default improves performance in uncommon situations yet severely bloats compilation of caller chains generally, and chained callee inlining can and often removes the caller chain _and_ nonspecialization issue for argument functions fixed at compile-time e.g. `foo(x, y) = map(+, x, y)`.

---

_[View the full topic](https://discourse.julialang.org/t/function-as-argument/106385)._
