[swift-evolution] Checking in; more thoughts on arrays and variadic generics

Tino Heth 2th at gmx.de
Mon Jan 30 06:45:31 CST 2017

> 2. More on Arrays
> Before, I’ve proposed expressions like “4 * Int” for arrays. But, looking back, it’s not very Swift-y. I had problems with some forms of the syntax giving the specification indices in the reverse order of the dereferencing indices. It looks too quick-and-dirty. And I want to have a revolution over arrays from C, like we gave the enum type.
> The new inspiration came from me looking at a random blog about Swift (1?) tuples, where a 2-Int tuple can be expressed by “(Int, Int)” and a 12-Int tuple by “(Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int)”, I thought the latter was too excessive, and that there should be a way to reduce the repetition. Oh:
> 	(repeat Int for 12)

I remember that discussion and I was happy that despite an enthusiastic start, it went nowhere:
Imho translating fixed-size arrays to tuples is just a hack that should be fixed, not extended.

Arrays are one of the most basic concepts in programming, so I don't want to mix them with tuples - especially as there is a clean alternative (there are still some pieces missing, but "Vector<type: Int, size: 12>" looks much better than any tuple-magic to me).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170130/09de813c/attachment.html>

More information about the swift-evolution mailing list