# FunctionWrappers in stdlib?

**URL:** <https://discourse.julialang.org/t/functionwrappers-in-stdlib/10007>\
**Category:** Internals & Design\
**Created:** [March 27, 2018, 3:21pm UTC](https://discourse.julialang.org/t/functionwrappers-in-stdlib/10007 "2018-03-27T15:21:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ExpandingMan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/expandingman/32/866_2.png) [@ExpandingMan](https://discourse.julialang.org/u/ExpandingMan)\
**Post date:** [March 27, 2018, 3:21pm UTC](https://discourse.julialang.org/t/functionwrappers-in-stdlib/10007/1 "2018-03-27T15:21:31Z")

</div>

I think we should have this, see [this issue](https://github.com/JuliaLang/julia/issues/13984) for a description of what those are and my argument for why it should be in stdlib.

These are currently used in [ReverseDiff.jl](https://github.com/JuliaDiff/ReverseDiff.jl). See my [simulator](https://github.com/ExpandingMan/Sim6502.jl) of a MOS 6502 CPU for another fun application. You will find that you need them every time you need to efficiently unbox a function (e.g. if you hold functions in a container), which seems like a fairly generic use case to me.

Opening this thread is nothing other than redundant, shameless promotion. Hopefully you’ll all forgive me for abusing discourse slightly 😊.

---

<div class="post-metadata">

**Author:** ![cortner](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cortner/32/204_2.png) [@cortner](https://discourse.julialang.org/u/cortner)\
**Post date:** [March 27, 2018, 4:31pm UTC](https://discourse.julialang.org/t/functionwrappers-in-stdlib/10007/2 "2018-03-27T16:31:11Z")

</div>

Very much in favour of guaranteed long-term support if FuncrionWrappers

---

<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:** [March 28, 2018, 6:56am UTC](https://discourse.julialang.org/t/functionwrappers-in-stdlib/10007/3 "2018-03-28T06:56:31Z")

</div>

I am under the impression that the core devs are currently focused on changes that need to be breaking before getting `v0.7` out, so anything can be done later is deprioritized. So I am not sure that bumping these issues is productive. Things don’t get lost, I expect they will be done later.

---

<div class="post-metadata">

**Author:** ![ExpandingMan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/expandingman/32/866_2.png) [@ExpandingMan](https://discourse.julialang.org/u/ExpandingMan)\
**Post date:** [March 28, 2018, 1:20pm UTC](https://discourse.julialang.org/t/functionwrappers-in-stdlib/10007/4 "2018-03-28T13:20:46Z")

</div>

> [@Tamas\_Papp](#):
>
> I am under the impression that the core devs are currently focused on changes that need to be breaking before getting v0.7

I know, my thinking was more 1.1 timeline.

I feel kind of awkward asking “please write and maintain this for me” on an open source project anyway, but this is the one thing that I can think of that you just “cannot do” right now in Julia. The stuff in `Base` and stdlib currently is great, but quite a bit of it I suspect most people would be able to create equivalent functionality for themselves if they needed, whereas this is something that probably only a handful of people have the expertise to write without extensive research, so it feels like kind of an awkward hole.

---

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [March 28, 2018, 1:55pm UTC](https://discourse.julialang.org/t/functionwrappers-in-stdlib/10007/5 "2018-03-28T13:55:54Z")

</div>

Speaking for myself, I don’t want to make `FunctionWrappers` official at this point because we may want something even _more_ integrated into the language than just a stdlib package. We may want syntax for it and perhaps some kind of enhanced higher order programming support for wrapped functions. (E.g. How is a single method in isolation different than a monotyped function?) If we make `FunctionWrappers` official now, that’s more potential deprecation work in the future. So I’d rather wait and think about this issue more when we have time and bandwidth to do so. Of course, we may look at it and just decide that it’s perfect as is and put it in the stdlib and be done. But I’m not certain of that and just deciding what to do is work.

---

<div class="post-metadata">

**Author:** ![ExpandingMan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/expandingman/32/866_2.png) [@ExpandingMan](https://discourse.julialang.org/u/ExpandingMan)\
**Post date:** [March 28, 2018, 2:04pm UTC](https://discourse.julialang.org/t/functionwrappers-in-stdlib/10007/6 "2018-03-28T14:04:53Z")

</div>

> [@StefanKarpinski](#):
>
> We may want syntax for it and perhaps some kind of enhanced higher order programming support for wrapped functions.

Sounds good to me! 😄
