<html><body><div>Am 26. April 2016 um 22:02 schrieb Dave Abrahams <dabrahams@apple.com>:<br><br><div><blockquote type="cite"><div class="msg-quote"><div class="_stretch"><span class="body-text-content"><br>on Tue Apr 26 2016, Thorsten Seitz <tseitz42-AT-icloud.com> wrote:<br><br><blockquote type="cite" class="quoted-plain-text">Am 23.04.2016 um 10:27 schrieb Pyry Jahkola via swift-evolution</blockquote><blockquote type="cite" class="quoted-plain-text"><swift-evolution@swift.org>:</blockquote><blockquote type="cite" class="quoted-plain-text"><br></blockquote><blockquote type="cite" class="quoted-plain-text">I'd like to second James Campbell's suggestion of a `mutate` keyword.</blockquote><blockquote type="cite" class="quoted-plain-text">Clarifying comments inline below:</blockquote><blockquote type="cite" class="quoted-plain-text"><br></blockquote><blockquote type="cite" class="quoted-plain-text">On 23 Apr 2016, at 00:24, Dave Abrahams via swift-evolution</blockquote><blockquote type="cite" class="quoted-plain-text"><swift-evolution@swift.org> wrote:</blockquote><blockquote type="cite" class="quoted-plain-text"><br></blockquote><blockquote type="cite" class="quoted-plain-text">This is not a new idea. Something almost identical to this has been</blockquote><blockquote type="cite" class="quoted-plain-text">explored and discussed quite thoroughly already:</blockquote><blockquote type="cite" class="quoted-plain-text"><<a href="https://github.com/apple/swift/blob/master/docs/proposals/Inplace.rst>" data-mce-href="https://github.com/apple/swift/blob/master/docs/proposals/Inplace.rst>">https://github.com/apple/swift/blob/master/docs/proposals/Inplace.rst></a>.</blockquote><blockquote type="cite" class="quoted-plain-text">In fact, it was implmented and later reverted because it raised</blockquote><blockquote type="cite" class="quoted-plain-text">language-design questions for which we had no good answers.</blockquote><blockquote type="cite" class="quoted-plain-text"><br></blockquote><blockquote type="cite" class="quoted-plain-text">I don't know if the following are particularly good answers, but I'll try</blockquote><blockquote type="cite" class="quoted-plain-text">anyway:</blockquote><blockquote type="cite" class="quoted-plain-text"><br></blockquote><blockquote type="cite" class="quoted-plain-text">I don't believe the choice of glyph (& vs =) affects any of the</blockquote><blockquote type="cite" class="quoted-plain-text"><br></blockquote><blockquote type="cite" class="quoted-plain-text">fundamental issues:</blockquote><blockquote type="cite" class="quoted-plain-text"><br></blockquote><blockquote type="cite" class="quoted-plain-text">* Should the x.=f() syntax be required for *every* mutating method</blockquote><blockquote type="cite" class="quoted-plain-text">invocation?</blockquote><blockquote type="cite" class="quoted-plain-text"><br></blockquote><blockquote type="cite" class="quoted-plain-text">Allow me to ask it differently: Should some specific syntax be required for</blockquote><blockquote type="cite" class="quoted-plain-text">every mutating method? — Yes.</blockquote><blockquote type="cite" class="quoted-plain-text"><br></blockquote><blockquote type="cite" class="quoted-plain-text">I think I like that idea.</blockquote><blockquote type="cite" class="quoted-plain-text"><br></blockquote><blockquote type="cite" class="quoted-plain-text">Should the syntax be `x.=f()`? — Not necessarily. I kinda like James</blockquote><blockquote type="cite" class="quoted-plain-text">Campbell's idea of a `mutate` keyword. Consider the following:</blockquote><blockquote type="cite" class="quoted-plain-text"><br></blockquote><blockquote type="cite" class="quoted-plain-text">var numbers = [5, 12, 6, 2]</blockquote><blockquote type="cite" class="quoted-plain-text">mutate numbers.append(10)</blockquote><blockquote type="cite" class="quoted-plain-text">mutate numbers.sort()</blockquote><blockquote type="cite" class="quoted-plain-text">if let biggest = mutate numbers.popLast() {</blockquote><blockquote type="cite" class="quoted-plain-text">print("The biggest number was:", biggest)</blockquote><blockquote type="cite" class="quoted-plain-text">}</blockquote><blockquote type="cite" class="quoted-plain-text"><br></blockquote><blockquote type="cite" class="quoted-plain-text">So `mutate` would work much like `try` but—unlike `try` which can move</blockquote><blockquote type="cite" class="quoted-plain-text">further to the left—`mutate` would have to always prefix the mutating</blockquote><blockquote type="cite" class="quoted-plain-text">receiver.</blockquote><blockquote type="cite" class="quoted-plain-text"><br></blockquote><blockquote type="cite" class="quoted-plain-text">That doesn't look so bad (we might shorten 'mutate' to 'mut', though I don't</blockquote><blockquote type="cite" class="quoted-plain-text">think that would be really necessary).</blockquote><br>We've already discussed this whole question length, specifically<br>considered the direction of an almost-identical language feature, and<br>ended up settling on the “form/ed/ing” naming conventions. If there is<br>some new information since then, it would be possible to handle</span></div></div></blockquote></div><div><span><br data-mce-bogus="1"></span></div><div><span>The new information might be that the "form" naming conventions have not been that well received, i.e. the naming discussion cannot really be described as "settled" :-)<br data-mce-bogus="1"></span></div><div><span><br data-mce-bogus="1"></span></div><div><span>-Thorsten<br data-mce-bogus="1"></span></div></div></body></html>