SE-0453: Vector, a fixed size array

Hm? These seem to me like stopgaps, providing the equivalent of:

extension Array {
  init(_ elements: some Sequence<Element>)
}

except that Sequence doesn't support non-copyable Element types or throwing, so it uses a closure instead.

I expect the new collection protocols will support both of these things, at which point the initialisers become redundant. So I don't think these will be used as precedent.

Speaking of which, initialisation from a sequence seems useful, but I couldn't find it mentioned in the proposal. The SIMD types have such an initialiser, and I think it makes sense on Vector as well.

2 Likes