Description
openedon Apr 3, 2019
When collecting an iterable into a column based table, it is not obvious what array type to use for the various elements. For example CategoricalValue
from CategoricalArrays should clearly be collected in a CategoricalArray
that is optimized for that type, WeakRefString
from WeakRefStrings belongs in a StringArray
(which is optimized to store those), DataValue
naturally belongs to a DataValueArray
etc.
This makes it very hard to write code that would collect an iterable into its "optimized container" without depending on all the above packages (or using Requires like here), which in my view is a design that does not scale. I feel that this could be solved by adding a defaultarray(T, sz) = Array{T}(undef, sz)
function in Base that the various packages (CategoricalArrays, WeakRefStrings, DataValueArrays) could then overload. In this way one could write a collect
optimized for the element type without any dependency.