[swift-evolution] Reduce with inout
Anton Zhilin
antonyzhilin at gmail.com
Wed Jan 18 02:00:31 CST 2017
While realizing that this name can cause confusion, I'd still prefer
`reduce(mutating:_:)`, because it looks like the only readable option to me.
Whatever name will be picked, I agree that traditional reduce without
mutation should retain its name.
2017-01-18 5:17 GMT+03:00 Xiaodi Wu via swift-evolution <
swift-evolution at swift.org>:
> A serious possibility would be: `reduce(mutableCopyOf: x) { ... }`.
>
> It's verbose, but the nicer-looking `reduce(mutating: x) { ... }` is
> incorrect since, as Charles pointed out to Dave, it's not `x` that's
> mutated but rather a mutable copy of it, so it doesn't matter if `x` itself
> is declared with `let` or `var`.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170118/57db3e62/attachment.html>
More information about the swift-evolution
mailing list