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

Dany St-Amant dsa.mls at icloud.com
Sat Jan 30 10:32:25 CST 2016

```> Le 29 janv. 2016 à 14:13, Dave via swift-evolution <swift-evolution at swift.org> a écrit :
>
> Speaking of spitballing, these can be nested/composed, right?
> let x = (3 x (0, 2 x “”), 2 x NSFileManager())

Looks like there’s a missing set of parenthesis. I would expect:

let x = ((3 x (0, 2 x “”)), (2 x NSFileManager()))

To gives these result

> So, I think that this would be correct:
> let x0 = x.0 // is ((Int, (String, String)), (Int, (String, String)), (Int, (String, String)))
> let x1 = x.1 // is (NSFileManager, NSFileManager)
> let xIdx0 = x.0[0] // is (Int, (String, String))
>
> Can we implicitly “unzip” the implicit "arrays”, as well?
> let x00 = x.0.0 // is (Int, Int, Int)… equivalent to let x00 = x.0.map { \$0.0 }
> let x01 = x.0.1 // is ((String, String), (String, String), (String, String))… equivalent to let x01 = x.0.map { \$0.1 }

As for the original
let x = (3 x (0, 2 x “”), 2 x NSFileManager())

The results would be:
let x0 = x.0 // is (Int, (String, String)
let x3 = x.3 // is NSFileManager
let xIdx0 = x.0[0] // is Int

Dany

>> On Jan 29, 2016, at 10:43, Joe Groff via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>>
>>
>>> On Jan 28, 2016, at 9:24 PM, Félix Cloutier <felixcca at yahoo.ca <mailto:felixcca at yahoo.ca>> wrote:
>>>
>>> To me, it's closely related to the declaration issue. By introducing a (N x Type) syntax, we're solving the LHS problem but leaving the RHS problem intact. If we want to spin it off into a separate proposal, I think that the most logical split is to have a proposal for subscripts on uniform tuples, and a a proposal for the shorthand syntax and a way to initialize values of these types.
>>
>> Just spitballing…we could bring the N x <expr> syntax to expressions as well, so that (5 x 0) is (0,0,0,0,0), and maybe (1, 3 x 0, 2) is (1, 0, 0, 0, 2). With integer literals it's hard to tell which side is which, though...
>>
>> -Joe
>>
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
>> https://lists.swift.org/mailman/listinfo/swift-evolution
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160130/7a12e292/attachment.html>
```