ok, I understand, thank you
TedvG
> On 25 Feb 2017, at 00:25, David Sweeris <[email protected]> wrote:
> 
> 
>> On Feb 24, 2017, at 13:41, Ted F.A. van Gaalen <[email protected]> wrote:
>> 
>> Hi David & Dave
>> 
>> can you explain that in more detail?
>>>> Wouldn’t that turn simple character access into a mutating function?
>> 
>> assigning like   s[11…14] = str  is of course, yes.
>> only then - that is if the character array thus has been changed - 
>> it has to update the string in storage, yes. 
>> 
>> but  str = s[n..<m]   doesn’t. mutate.
>> so you’d have to maintain keep (private) a isChanged: Bool or bit.
>> a checksum over the character array .  
>> ?
> 
> It mutates because the String has to instantiate the Array<Character> to 
> which you're indexing into, if it doesn't already exist. It may not make any 
> externally visible changes, but it's still a change.
> 
> - Dave Sweeris

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to