<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div><br><br>Sent from my iPad</div><div><br>On Apr 27, 2016, at 12:37 AM, Thorsten Seitz via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br><br></div><blockquote type="cite"><div><div>Am 26. April 2016 um 22:02 schrieb Dave Abrahams <<a href="mailto:dabrahams@apple.com">dabrahams@apple.com</a>>:<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 <<a href="http://tseitz42-at-icloud.com">tseitz42-AT-icloud.com</a>> 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"><<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>>:</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"><<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> 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></div></blockquote><div><br></div><div>Also, I could be wrong but IIRC the discussion of having some kind of "mutation" syntax post Swift 3 was held open when that discussion concluded. It was just out of scope for Swift 3 to address all of the necessary issues. </div><div><br></div><div>I hope this issue isn't settled once and for all as I am not very happy with the current solution. The "form" names are quite awkward and confusing IMO. I would eventually get used to them but that is the problem - they will really take getting used to.</div><div><br></div><div><br><blockquote type="cite"><div><div><div><span><br data-mce-bogus="1"></span></div><div><span>-Thorsten<br data-mce-bogus="1"></span></div></div></div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></div></body></html>