On 26 Apr 2017, at 18:13, Ole Begemann <o...@oleb.net> wrote:
> There have been requests for something like this on swift-evolution, e.g.
> here in the context of the discussion about a `reduce` variant that takes
> `inout` arguments:
> https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20170123/030641.html
>
> <https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20170123/030641.html>
Jonathan Hull is indeed asking for the same thing.
> But as far as I know there hasn't been a proposal for adding this. (Is it
> important enough to have in the standard library? I don't know.)
I do it all the time!
BTW, it seems that the possibility to edit an array in this way isn’t mentioned
explicitly anywhere in The Swift Programming Language.
Formally it requires two copies, like
myInstanceCopy = array[index]
myInstanceCopy.field = newValue
array[index] = myInstanceCopy
Jan E.
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users