[swift-evolution] Reduce with inout
jgroff at apple.com
Wed Jan 18 11:21:50 CST 2017
> On Jan 18, 2017, at 2:11 AM, Chris Eidhof via swift-evolution <swift-evolution at swift.org> wrote:
> I don't think we should replace the current `reduce` with the `inout` version, also because the current reduce can be really useful as well (e.g. when the return type is an Int).
> One downside of having a different name is that it'll be harder to discover this version. If stressing the type-checker is the only problem, then maybe we should improve the type-checker, instead of placing that burden on every user of the language.
That's a nice sentiment, and there's certainly a lot of work we have yet to do on the type checker to make it generally better. Higher-order functions like `reduce` naturally chain into larger expressions, though, and having such a fundamental sequence operation drag down the type-checker every time you use it would be unfortunate if we can avoid overloading the name.
More information about the swift-evolution