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

Joe Groff jgroff at apple.com
Fri Jan 29 15:19:39 CST 2016


> On Jan 29, 2016, at 1:11 PM, Dave Abrahams via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
> on Thu Jan 28 2016, Chris Lattner <swift-evolution at swift.org> wrote:
> 
>>> 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.
> 
> I think this avenue leaves some really crucial use-cases on the table,
> e.g. implementing bounded-size dynamically-growable arrays.

It doesn't foreclose on the future possibility, either. With integer generic parameters you could conceivably build something like that out of a primitive fixed-size tuple type.

-Joe


More information about the swift-evolution mailing list