<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">I'd like to second James Campbell's suggestion of a `<font face="Menlo" class=""><span style="font-size: 11px;" class="">mutate</span></font>` keyword. Clarifying comments inline below:</div><br class=""><blockquote type="cite" class="">On 23 Apr 2016, at 00:24, Dave Abrahams via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""></blockquote><div><blockquote type="cite" class=""><br class="Apple-interchange-newline"><div class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">This is not a new idea. &nbsp;Something almost identical to this has been</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">explored and discussed quite thoroughly already:</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">&lt;</span><a href="https://github.com/apple/swift/blob/master/docs/proposals/Inplace.rst" style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">https://github.com/apple/swift/blob/master/docs/proposals/Inplace.rst</a><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">&gt;.</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">In fact, it was implmented and later reverted because it raised</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">language-design questions for which we had no good answers.</span></div></blockquote><div><br class=""></div><div>I don't know if the following are particularly good answers, but I'll try anyway:</div><br class=""><blockquote type="cite" class=""><div class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">I don't&nbsp;</span><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">believe the choice of glyph (&amp; vs =) affects any of the</span></div></blockquote><blockquote type="cite" class=""><div class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">fundamental&nbsp;</span><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">issues:</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">* Should the x.=f() syntax be required for *every* mutating method</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">&nbsp;invocation?</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></blockquote><div><br class=""></div><div>Allow me to ask it differently: Should <b class="">some</b>&nbsp;specific syntax be required for every&nbsp;mutating method? — Yes.</div><div><br class=""></div><div>Should the syntax be `<font face="Menlo" class=""><span style="font-size: 11px;" class="">x.=f()</span></font>`? — Not necessarily. I kinda like James Campbell's idea of a `<font face="Menlo" class=""><span style="font-size: 11px;" class="">mutate</span></font>` keyword. Consider the following:</div><div><br class=""></div><div><font face="Menlo" class=""><span style="font-size: 11px;" class="">&nbsp; &nbsp; <b class="">var</b> numbers = [5, 12, 6, 2]</span></font></div><div><font face="Menlo" class=""><span style="font-size: 11px;" class="">&nbsp; &nbsp; <b class="">mutate</b> numbers.append(10)</span></font></div><div><font face="Menlo" class=""><span style="font-size: 11px;" class="">&nbsp; &nbsp; <b class="">mutate</b> numbers.sort()</span></font></div><div><font face="Menlo" class=""><span style="font-size: 11px;" class="">&nbsp; &nbsp; <b class="">if let</b>&nbsp;</span></font><span style="font-family: Menlo; font-size: 11px;" class="">biggest</span><font face="Menlo" class=""><span style="font-size: 11px;" class="">&nbsp;= <b class="">mutate</b> numbers.popLast() {</span></font></div><div><font face="Menlo" class=""><span style="font-size: 11px;" class="">&nbsp; &nbsp; &nbsp; &nbsp; print("The biggest number was:", biggest)</span></font></div><div><font face="Menlo" class=""><span style="font-size: 11px;" class="">&nbsp; &nbsp; }</span></font></div><div><br class=""></div><div>So `<font face="Menlo" class=""><span style="font-size: 11px;" class="">mutate</span></font>` would work much like `<font face="Menlo" class=""><span style="font-size: 11px;" class="">try</span></font>` but—unlike `<font face="Menlo" class=""><span style="font-size: 11px;" class="">try</span></font>` which can move further to the left—`<font face="Menlo" class=""><span style="font-size: 11px;" class="">mutate</span></font>` would have to always prefix the mutating receiver. Here's a&nbsp;contrived example of a corner case:</div><div><br class=""></div><div><font face="Menlo" class=""><span style="font-size: 11px;" class="">&nbsp; &nbsp; <b class="">enum</b> Error : ErrorType { <b class="">case</b> BadNumber }</span></font></div><div><font face="Menlo" class=""><span style="font-size: 11px;" class=""><br class=""></span></font></div><div><font face="Menlo" class=""><span style="font-size: 11px;" class="">&nbsp; &nbsp; <b class="">func</b>&nbsp;demo() <b class="">throws</b> -&gt; Int {</span></font></div><div><font face="Menlo" class=""><span style="font-size: 11px;" class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span></font></div><div><font face="Menlo" class=""><span style="font-size: 11px;" class="">&nbsp; &nbsp; }</span></font></div><div><br class=""></div><blockquote type="cite" class=""><div class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">* Are assignment methods a redundant way to spell mutating methods?</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">&nbsp;Should we really have both mechanisms?</span></div></blockquote><div><br class=""></div><div>(I had to look up the definition of an <i class="">assignment method</i>. For the uninitiated, Dave is talking about what's written here:&nbsp;<a href="https://github.com/apple/swift/blob/master/docs/proposals/Inplace.rst#use-one-simple-name" class="">https://github.com/apple/swift/blob/master/docs/proposals/Inplace.rst#use-one-simple-name</a>.)</div><div><br class=""></div><div>— Yes they are redundant, and no, we should not have both.</div><div><br class=""></div><div>With `<font face="Menlo" class=""><span style="font-size: 11px;" class="">mutate</span></font>` required at the call site, we could simply allow both overloads `<font face="Menlo" class=""><span style="font-size: 11px;" class=""><b class="">func</b> sort()</span></font>` and `<font face="Menlo" class=""><span style="font-size: 11px;" class=""><b class="">mutating func</b> sort()</span></font>` to coexist, because the call sites become unambiguous:</div><div><br class=""></div><div><font face="Menlo" class=""><span style="font-size: 11px;" class="">&nbsp; &nbsp; <b class="">let</b> originals = [2, 1, 3, 0, 4, 2]</span></font></div><div><font face="Menlo" class=""><span style="font-size: 11px;" class="">&nbsp; &nbsp; <b class="">var</b> copies = originals</span></font></div><div><font face="Menlo" class=""><span style="font-size: 11px;" class=""><br class=""></span></font></div><div><font face="Menlo" class=""><span style="font-size: 11px;" class="">&nbsp; &nbsp; originals.sort() &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <font color="#919191" class="">//&nbsp;<b class="">warning:</b>&nbsp;result of call to 'sort()' is unused</font></span></font></div><div><font face="Menlo" class=""><span style="font-size: 11px;" class="">&nbsp; &nbsp;&nbsp;<font color="#ff2600" class=""><b class="">mutate</b>&nbsp;originals.sort()</font> &nbsp; &nbsp;<font color="#919191" class="">// <b class="">compiler error</b></font></span></font></div><div><font face="Menlo" class=""><span style="font-size: 11px;" class="">&nbsp; &nbsp; <b class="">let</b> xs = originals.sort() &nbsp;<font color="#919191" class="">// ok</font></span></font></div><div><br class=""></div><div><font face="Menlo" class=""><span style="font-size: 11px;" class="">&nbsp; &nbsp; copies.sort()</span></font><span style="font-family: Menlo; font-size: 11px;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="font-family: Menlo; font-size: 11px;" class=""><font color="#919191" class="">//&nbsp;<b class="">warning:</b>&nbsp;result of call to 'sort()' is unused</font></span></div><div><font face="Menlo" class=""><span style="font-size: 11px;" class="">&nbsp; &nbsp;&nbsp;<b class="">mutate</b>&nbsp;copies.sort() &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<font color="#919191" class="">// ok</font></span></font></div><div><font face="Menlo" class=""><span style="font-size: 11px;" class="">&nbsp; &nbsp; <b class="">let</b> ys = copies.sort() &nbsp; &nbsp; &nbsp; &nbsp;<font color="#919191" class="">// ok</font></span></font></div><div><span style="font-size: 11px; font-family: Menlo;" class="">&nbsp; &nbsp; <b class="">let</b> zs = mutate copies.sort() <font color="#919191" class="">//&nbsp;<b class="">warning:</b>&nbsp;constant 'x' inferred to have type '()', which may be unexpected</font></span></div><div><br class=""></div><div>The language could also allow the use of</div><div><font face="Menlo" class=""><span style="font-size: 11px;" class=""><b class=""><br class=""></b></span></font></div><div><b style="font-family: Menlo; font-size: 11px;" class="">&nbsp; &nbsp; mutate</b><font face="Menlo" class=""><span style="font-size: 11px;" class=""> x.next()</span></font></div><div><br class=""></div><div>as shorthand for</div><div><br class=""></div><div><font face="Menlo" class=""><span style="font-size: 11px;" class="">&nbsp; &nbsp; x = x.next()</span></font></div><div><br class=""></div><div>when only the non-mutating variant `<font face="Menlo" class=""><span style="font-size: 11px;" class=""><b class="">func</b> next() -&gt; <b class="">Self</b></span></font>` exists with compatible return type.</div><br class=""><blockquote type="cite" class=""><div class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">* Can we really introduce this feature without having a way to apply it</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">&nbsp;to class types?</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></blockquote><div><br class=""></div><div>Yes we can. Why complicate the naming of value type members with the complexities of reference semantics? The current API naming conventions are <i class="">good</i> for reference types which sometimes come with unobvious to obscure behaviour (i.e. anything from bumping an internal counter to firing missiles and wiping hard drives).</div><div><br class=""></div><div>But value types ought to have no side effects (besides memory allocation and logging maybe), and so we don't necessarily need that strong a naming convention to limit their collateral damage.</div><div><br class=""></div><div>If the `<font face="Menlo" class=""><span style="font-size: 11px;" class="">mutate</span></font>` keyword became required for calling `<font face="Menlo" class=""><span style="font-size: 11px;" class="">mutating</span></font>` methods, then operators would remain the only place where naming convention were needed to distinguish mutation:</div><div><br class=""></div><div><ul class="MailOutline"><li class="">Mutating assignment is <b class="">explicit</b>: `<font face="Menlo" class=""><span style="font-size: 11px;" class="">xs = [1, 2] + xs + [2, 1]</span></font>` (i.e. `<font face="Menlo" class=""><span style="font-size: 11px;" class="">=</span></font>` without `<font face="Menlo" class=""><span style="font-size: 11px;" class="">let</span></font>` or `<font face="Menlo" class=""><span style="font-size: 11px;" class="">var</span></font>` means mutation)</li><li class="">Mutating method call becomes&nbsp;<b class="">explicit</b>: `<font face="Menlo" class=""><span style="font-size: 11px;" class=""><b class="">mutate</b> xs.sort()</span></font>` and `<font face="Menlo" class=""><span style="font-size: 11px;" class=""><b class="">let</b> x = <b class="">mutate</b> xs.removeAtIndex(2)</span></font>`</li><li class="">Mutating function arguments are <b class="">explicit</b>&nbsp;with the&nbsp;`<font face="Menlo" class=""><span style="font-size: 11px;" class="">&amp;</span></font>` prefix: `<font face="Menlo" class=""><span style="font-size: 11px;" class="">swap(&amp;xs, &amp;ys)</span></font>`</li><li class="">Mutating operators are <b class="">implicit</b> and&nbsp;<i class="">by convention,</i>&nbsp;should end with the `=` symbol: `<font face="Menlo" class=""><span style="font-size: 11px;" class="">xs += [8, 9]</span></font>`</li><li class="">Reference types have no notion of `<font face="Menlo" class=""><span style="font-size: 11px;" class="">mutating</span></font>` members (and probably ought to remain that way) so they mutate&nbsp;<b class="">implicitly</b>.</li></ul></div><br class=""><blockquote type="cite" class=""><div class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">I should also point out that under the assignment method paradigm one</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">would probably need to re-evalutate rules for naming. &nbsp;Under the current</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">API guidelines' approach, we'd write:</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">&nbsp;&nbsp;&nbsp;x.=sorted() &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// sort x in-place</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">and I am not sure how easy that would be for people to swallow</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">considering how much more straightforward</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">&nbsp;&nbsp;&nbsp;x.sort() &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// current way to sort x in-place</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">is, and because the language now contains explicit notation for</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">mutation, it becomes harder to argue against theis pair:</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">&nbsp;&nbsp;&nbsp;y = x.sort()</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">&nbsp;&nbsp;&nbsp;x.=sort() &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// sort x in place</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></blockquote><div><br class=""></div><div>I agree that the current API guidelines wouldn't work for value types anymore. Both `sort` and `sorted` would be called `sort`.</div><br class=""><blockquote type="cite" class=""><div class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Lastly, I should point out that the proposal does nothing to solve the</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">problem of `c.formSuccessor(&amp;i)`, since that doesn't mutate the</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">receiver.</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></blockquote><div><br class=""></div><div>This proposal does address the problem of `<font face="Menlo" class=""><span style="font-size: 11px;" class="">c.formSuccessor(&amp;i)</span></font>`. Given that it's value types at play here, what mutates in the following is unambiguous even to non-native English speakers:</div><div><br class=""></div><div><font face="Menlo" class=""><span style="font-size: 11px;" class="">&nbsp; &nbsp; c.frobnicate(&amp;i) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<font color="#919191" class="">// cannot possibly mutate c but mutates i</font></span></font></div><div><font face="Menlo" class=""><span style="font-size: 11px;" class="">&nbsp; &nbsp; </span><b style="font-size: 11px;" class="">let</b><span style="font-size: 11px;" class=""> j = c.frobnicate(i) &nbsp; &nbsp; &nbsp; &nbsp; </span><font color="#919191" style="font-size: 11px;" class="">// cannot possibly mutate either</font></font></div><div><font face="Menlo" class=""><span style="font-size: 11px;" class="">&nbsp; &nbsp; </span><b style="font-size: 11px;" class="">mutate</b><span style="font-size: 11px;" class=""> c.frobnicate(i) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><font color="#919191" style="font-size: 11px;" class="">// mutates c</font></font></div><div><font face="Menlo" class=""><span style="font-size: 11px;" class="">&nbsp; &nbsp; </span><b style="font-size: 11px;" class="">let</b><span style="font-size: 11px;" class=""> k = </span><b style="font-size: 11px;" class="">mutate</b><span style="font-size: 11px;" class=""> c.frobnicate(&amp;i) </span><font color="#919191" style="font-size: 11px;" class="">// mutates both</font></font></div><br class=""><blockquote type="cite" class=""><div class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">I still like the proposal's basic approach and would love to see it used</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">to address these naming problems, but I want to be clear that it's by no</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">means a panacea and there are real obstacles between here and actually</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">being able to apply it. &nbsp;If you want to move forward with something like</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">this, you need to solve the problems described above.</span></div></blockquote></div><br class="">I think this proposal would simplify all code handling value types. Yes, it adds one keyword of boilerplate but wins clarity in return. I think reference types should stay separate from this discussion, as their mutation has always been implicit anyway. The API guidelines set a good convention for them.<br class=""><div class=""><br class=""></div><div class="">— Pyry</div><div class=""><br class=""></div></body></html>