While the type-widening of collect
for EltypeUnknown
is extremely useful for generic code, my recent experience with a large codebase with time-consuming and occasionally failing inference suggests that these two alternatives would be useful:
-
a version of
collect
which assumes that all values from an iterator have the same type (practically, it would get one element, and use its type from then on), and it is free to error and abort otherwise, -
a version of
collect
which, when two values do not have the same concrete type, can just widen toAny
and be done with it.
Parts of the machinery for this already exist in or could be adapted from base/array.jl
, but are not part of the exposed API. I thought I would ask before opening an issue. Suggestions for the API are also welcome.