[Swift-devel] Associative array in Swift [GSoC]

Ben Clifford benc at hawaga.org.uk
Sat Jun 18 19:36:55 CDT 2011


On Jun 19, 2011, at 1:21 AM, Mihael Hategan wrote:

> I wasn't discussing an issue of semantics. I think we agree on that. I'm
> simply saying that I prefer one syntax to the other 

ok. I'm not overly enthused about the syntax either way.

>> 
>> I personally find the idea of expression what looks like a mutating 
>> concatenation but isn't really to be more distasteful.
> 
> Except it is a mutating concatenation. But it's one that is acceptable
> because there is no way to have code that is nondeterministic because of
> it. It's a non-destructive mutation.

do you regard the 2nd statement in:

a[0] = 4343;
a[1] = 54354;

to be mutating? if so, then a += 54354; is also a mutating concatenation in that definition of the word, and I agree with you. Otherwise I disagree with you.

But my perspective is that in a swift run, the 'a' array above has a single value, described as: "the 0th element is 4343, and the 1st element is 4343" and that the value becomes more accurately known as the run progresses until such time as you know its value completely. In that sense, the 2nd statement above, and the concatenation-like operators discussed in this thread are absolutely not mutating: they define the final value and that is all. From that perspective, the ability to pipeline based on partial knowledge of that value is somewhat accidental.

-- 




More information about the Swift-devel mailing list