[swift-evolution] Disambiguate Return Type With Void
jordan_rose at apple.com
Tue Apr 26 11:26:57 CDT 2016
> On Apr 26, 2016, at 06:57, Антон Жилин via swift-evolution <swift-evolution at swift.org> wrote:
> > Also, technically we can assign a value to Void function
> This proposal will not disallow that. Just non-Void functions will be preferred when result is used.
> array.sort(..) // mutating
> let array2 = array.sort(..) // non-mutating, instead of array.sorted()
> I think, that's actually the best solution to mutating / non-mutating convention!
There are mutating methods that have return values, like Dictionary.removeValue(forKey:). Admittedly there’s no non-mutating version of that at the moment, but that doesn’t mean there couldn’t be.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution