-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Open
Labels
arrays[a, r, r, a, y, s][a, r, r, a, y, s]designDesign of APIs or of the language itselfDesign of APIs or of the language itself
Description
The docs for collect(collection)
says that it will return an Array
(see here). The implementation, though, calls similar(Array{T}, axes(A))
to create the container that will be returned, and that is explicitly not required to return an Array
(see here).
The net effect is that for example
using StaticArrays
x = collect(i for i in SA[1,2])
will not return an Array
.
I think either the docs should be updated to say that collect
will return an AbstractArray
, or the collect
implementation should be changed to actually always return an Array
, no matter what.
It certainly would be very handy to have a function in base that one can call on a collection that guarantees that one gets an Array
, and not some custom array type.
timholy and nalimilan
Metadata
Metadata
Assignees
Labels
arrays[a, r, r, a, y, s][a, r, r, a, y, s]designDesign of APIs or of the language itselfDesign of APIs or of the language itself