Description
In #702 (comment) @tkf suggested that it would be helpful to have push
promote the type. I'm opening this issue because while it's easy to implement I don't have a strong feeling for the benefits and drawbacks.
The main drawback I see is that it's quite different from push!
and might be surprising if b = push(a, element)
gives b
with a different eltype
from a
.
But other than quibble it seems natural for functional manipulation of immutable data structures if the type is promoted. (Wrinkle: for consistency with StaticArrays constructors this would have to be promotion via promote_type
rather than pure widening, otherwise we'll quickly get abstract types in numeric code.)
If we did this, we should also make pushfirst
and insert
the same for consistency.