[swift-evolution] [Planning][Request] "constexpr" for Swift 5
scanon at apple.com
Tue Aug 1 05:28:23 CDT 2017
Sent from my iPhone
> On Jul 31, 2017, at 23:47, John McCall via swift-evolution <swift-evolution at swift.org> wrote:
> I disagree; it seems to me that a homogeneous fixed-size sequence is its own concept, and there isn't any natural link between that concept and that of a tuple. The elements of a tuple are independent with no naturally-implied relationship; or put another way, tuple indices are nominal, not ordinal.
Right. This distinction is subtle, but important, even when the tuple is homogenous.
For the mathematically-inclined, this is much like the distinction between R^2 (vector / fixed size array) and C (tuple / struct). They are isomorphic as vector spaces over R, but C has a bunch of extra structure that depends on one piece being real and the other being imaginary, but in R^2 the two components are always treated the same.
This even has calling convention implications; for efficiency, on most architectures, most of the time, it's best to pass a two-element vector as elements 0 and 1 of a vector register, but to pass a complex number as two scalars.
More information about the swift-evolution