Should `collect` also be deprecated, like `full`?


I’m very glad to see full deprecated: I was never sure what exactly it meant, whereas Matrix(...) is unambiguous.

Does the same argument apply to collect? For example, I’m surprised the following returns an Array (in 0.6):

julia> collect(CartesianRange(CartesianIndex((1,1)), CartesianIndex((2,2))))
2×2 Array{CartesianIndex{2},2}:
 CartesianIndex{2}((1, 1))  CartesianIndex{2}((1, 2))
 CartesianIndex{2}((2, 1))  CartesianIndex{2}((2, 2))

Insisting on the use of Array/Vector/Matrix instead of collect seems more explicit and predictable.


Yes, there is work in progress towards that. See and recent development of


FWIW, I often collect in order to sort.


You’d call sort(Vector(itr)). That’s actually a good example why collect is currently flawed: if it returns a matrix then calling sort will fail.


Or sort could collect automatically when needed, so we would just have to sort(itr).