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

Jordan Rose jordan_rose at apple.com
Fri Jan 29 13:23:07 CST 2016

```> On Jan 29, 2016, at 10:43, Joe Groff via swift-evolution <swift-evolution at swift.org> wrote:
>
>
>> On Jan 28, 2016, at 9:24 PM, Félix Cloutier <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...

I'm not quite happy with this. Consider this case:

// In some library...
typealias FixedSizeBuffer = (256 x CChar)

// In my code...
var buffer: FixedSizeBuffer = /*???*/
generateCryptographicNoise(&buffer)

I shouldn't really have to know that 'buffer' has 256 elements.

Throwing out some possibilities:

var buffer: FixedSizeBuffer = (0...)
var buffer: FixedSizeBuffer = (* x 0)
var buffer: FixedSizeBuffer = (repeat 0)

…none of which I'm particularly happy with. (The first one is inconsistent with the not-actually-proposed syntax for forwarding variadics.)

Jordan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160129/4a3173f0/attachment.html>
```