[swift-evolution] Proposal: Contiguous Variables (A.K.A. Fixed Sized Array Type)
Chris Lattner
clattner at apple.com
Thu Jan 28 23:50:52 CST 2016
> On Jan 28, 2016, at 9:41 PM, Félix Cloutier <felixcca at yahoo.ca> wrote:
>
> I think that (4 x Int) needs to be syntax sugar for (Int, Int, Int, Int). Not having them the same would introduce awkward cases into the language.
Agreed. This means that:
let values: (4 x Int)(repeatedValue: 0) // Is this possible?
will not be possible.
> Because of that, I also think that forcing people to use the subscript would have some awkward consequences. What if I have a func<T, U> that uses a (T, U) tuple and both T and U happen to be the same type?
I don’t understand this concern.
> So I think that tuples whose elements all have the same type should get a subscript but shouldn't lose direct field access.
Agreed.
-Chris
More information about the swift-evolution
mailing list