[swift-evolution] [Pitch] New Version of Array Proposal

Daryle Walker darylew at mac.com
Wed Aug 2 23:26:06 CDT 2017


> On Aug 1, 2017, at 7:21 PM, John McCall <rjmccall at apple.com> wrote:
> 
>> On Aug 1, 2017, at 5:49 PM, David Sweeris via swift-evolution <swift-evolution at swift.org> wrote:
>>> On Aug 1, 2017, at 10:54 AM, Daryle Walker via swift-evolution <swift-evolution at swift.org> wrote:
>>> 
>>> A tuple can have its members initialized in piecemeal and still satisfy deterministic initialization. The named types need to do all their sub-objects' initializations before any designated initializer ends. I want the former for array instances, not the latter. It’s important for numeric applications, so math arrays don’t have to be set twice, once for an arbitrary default and again for the real data.
>> 
>> Eh? What do you mean by "initialized in piecemeal"? These both give errors:
>> let x:(Int, Int) = (0) // something about not being able to convert `Int` to `(Int, Int)`
>> let x:(Int, Int) = (0, _) // something about "_" only being allowed in patterns
>> 
>> Is that what you're talking about?
> 
> I think he means that you can do
> 
> var x: (Int,Int)
> x.0 = 0
> x.1 = 1
> 
> This is generally not allowed for other aggregates outside of initializers.

Yes, this.

— 
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com 



More information about the swift-evolution mailing list