[swift-evolution] CollectionType on uniform tuples [forked off Contiguous Variables]

Félix Cloutier felixcca at yahoo.ca
Thu Feb 11 16:55:24 CST 2016


How realistic is it to also have a `count` getter? If we can't have `for elem in tuple`, at least that would allow `for i in 0..<tuple.count`.

Félix

> Le 11 févr. 2016 à 15:38:07, Chris Lattner <clattner at apple.com> a écrit :
> 
> 
>> On Feb 11, 2016, at 10:59 AM, Douglas Gregor via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>> 
>>> 
>>> On Feb 11, 2016, at 9:12 AM, Félix Cloutier via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>>> 
>>> Hi all,
>>> 
>>> Since the original fixed-size array thread is somewhat stalling, I forked off the subscript part into this: Treat uniform tuples as collections <https://github.com/zneak/swift-evolution/blob/uniform-tuples/proposals/00nn-collectiontype-for-tuples.md>
>> This specific proposal is a non-starter for me, because it lands squarely in the "death valley" of being extremely invasive on the implementation while providing only a small amount of relative value.
> 
> I agree with Doug on this.  I still think the right approach is to:
> 
> 1) add a subscript on tuples with a consistent element kind.
> 2) add some type sugar for defining these types
> 3) consider a convenient form for defining an initializer on these.
> 
> To me, that is the order of priority.  Just getting #1 and #2 would seriously move the needle on making C arrays work better, with very little implementation complexity.  #3 would be nice, but seems less important.
> 
> -Chris
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160211/281ff5e4/attachment.html>


More information about the swift-evolution mailing list