<div dir="ltr">Let's expand on that situation. Dictionary would have these methods:<div><br><div>@discardableResult func removeValue(forKey key: Key) -> Value?<br></div><div>func removeValue(forKey key: Key) -> Self</div><div><br></div><div>I would argue that these two versions are not semantically identical: (1) returns removed value while (2) does not.</div></div><div>Therefore they should have different names. In this case, we can rename them like this:</div><div><br></div><div><div>@discardableResult func removeValue(forKey key: Key) -> Value?<br></div><div>func remove(key key: Key) -> Self</div></div><div><br></div><div>Or like this:</div><div><br></div><div><div>func removeValue(forKey key: Key) -> Value?<br></div>func remove(key key: Key) -> Void<div>func remove(key key: Key) -> Self<br></div></div><div><br></div><div>- Anton</div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-04-26 19:26 GMT+03:00 Jordan Rose <span dir="ltr"><<a href="mailto:jordan_rose@apple.com" target="_blank">jordan_rose@apple.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><span class=""><br><div><blockquote type="cite"><div>On Apr 26, 2016, at 06:57, Антон Жилин via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:</div><br><div><div dir="ltr">+1<div><br></div><div>> Also, technically we can assign a value to Void function<div>This proposal will not disallow that. Just non-Void functions will be preferred when result is used.</div><div><pre style="white-space:pre-wrap">array.sort(..) // mutating
let array2 = array.sort(..) // non-mutating, instead of array.sorted()</pre><pre style="white-space:pre-wrap"><font face="arial, helvetica, sans-serif">I think, that's actually the best solution to mutating / non-mutating convention!</font></pre></div></div></div></div></blockquote></div></span><div>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.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Jordan</div><br></font></span></div></blockquote></div><br></div>