# Export \`Base.reducedim!\`, \`Base.mapreducedim!\`?

**URL:** <https://discourse.julialang.org/t/export-base-reducedim-base-mapreducedim/16347>\
**Category:** Internals & Design\
**Tags:** question, proposal\
**Created:** [October 15, 2018, 3:19pm UTC](https://discourse.julialang.org/t/export-base-reducedim-base-mapreducedim/16347 "2018-10-15T15:19:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![e3c6](https://avatars.discourse-cdn.com/v4/letter/e/e79b87/32.png) [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Post date:** [October 15, 2018, 3:19pm UTC](https://discourse.julialang.org/t/export-base-reducedim-base-mapreducedim/16347/1 "2018-10-15T15:19:10Z")

</div>

Why `Base.reducedim!`, `Base.mapreducedim!` are not exported? They seem generically useful. I want to use them but I don’t want my code to be broken in a future version. Also, maybe rename them to the shorter `reduce!`, `mapreduce!`?

---

<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 15, 2018, 3:24pm UTC](https://discourse.julialang.org/t/export-base-reducedim-base-mapreducedim/16347/2 "2018-10-15T15:24:31Z")

</div>

Moving things into the API is done cautiously, as removing them is much more costly (can only happen in major version changes). That’s why exporting is conservative from `Base`.

That said, a lot of packages rely on technically unexported functionality. If you explicitly do `using Base: reducedim!` in your package, you will learn very quickly from the unit tests if it is removed.

Also, since (as you said) these are very useful it is reasonable to expect that they will always be available in some form so fixing changes should be easy. So I would not be concerned about just using these.

---

<div class="post-metadata">

**Author:** ![e3c6](https://avatars.discourse-cdn.com/v4/letter/e/e79b87/32.png) [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Post date:** [October 15, 2018, 3:29pm UTC](https://discourse.julialang.org/t/export-base-reducedim-base-mapreducedim/16347/3 "2018-10-15T15:29:37Z")

</div>

Ok. I created an issue in case they decide to export them in the future.

[https://github.com/JuliaLang/julia/issues/29655](https://github.com/JuliaLang/julia/issues/29655)

---

<div class="post-metadata">

**Author:** ![Rui](https://avatars.discourse-cdn.com/v4/letter/r/ba8739/32.png) [@Rui](https://discourse.julialang.org/u/Rui)\
**Post date:** [October 15, 2018, 3:58pm UTC](https://discourse.julialang.org/t/export-base-reducedim-base-mapreducedim/16347/4 "2018-10-15T15:58:02Z")

</div>

What do they do?

---

<div class="post-metadata">

**Author:** ![e3c6](https://avatars.discourse-cdn.com/v4/letter/e/e79b87/32.png) [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Post date:** [October 15, 2018, 4:02pm UTC](https://discourse.julialang.org/t/export-base-reducedim-base-mapreducedim/16347/5 "2018-10-15T16:02:46Z")

</div>

Like `reduce` and `mapreduce`, but write results to pre-allocated storage. It also infers the dimensions to reduce from the singleton dimensions of the pre-allocated results array (like `sum!).
