[swift-evolution] Proposal: Contiguous Variables (A.K.A. Fixed Sized Array Type)

Brent Royal-Gordon brent at architechies.com
Wed Feb 3 08:09:39 CST 2016

> I sort of disagree, but in my mind (and coming from a C++ background) (compile-time) fixed-size arrays could be regarded as a specific subset of tuples, namely the ones where all elements have the same type.
> If we had the capability to have the subscript-operator / indexing return different types depending on the argument (which then would have to be known at compile-time), this would fall in place pretty nicely.

A proposal along these lines appears to already be in the works. However, tuple arrays still aren't quite first-class types—you can't even loop over them. Nor does that address other cases like ring buffers with a generic size.

Tuple arrays are a great way to get some extra mileage out of an existing feature, but they're not a 100% solution.

Brent Royal-Gordon

More information about the swift-evolution mailing list