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

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!?

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.

1 Like

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

What do they do?

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!).

1 Like