<div dir="auto"><div>I'm also in camp 2. I prefer the past tense style, for the logic explained via sort() vs sorted().<br><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Wed, Sep 10, 2025, 12:31 PM Chen Liang <<a href="mailto:chen.l.liang@oracle.com">chen.l.liang@oracle.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div style="font-family:"Calibri Light","Helvetica Light",sans-serif;font-size:12pt;color:rgb(0,0,0)">
I agree an adjective or a noun method name to indicate a derived distinct object is better. Such pattern is seen in some wrapper class methods, like Integer.lowestOneBit. A verb name like "add" works better for static methods that take two BigDecimal. Since
Brian is talking about type classes in this JVMLS, I would assume the verb names like "add" would be more suitable for the type classes than on the numeric types themselves.</div>
<div style="font-family:"Calibri Light","Helvetica Light",sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:"Calibri Light","Helvetica Light",sans-serif;font-size:12pt;color:rgb(0,0,0)">
Chen</div>
<div id="m_-2345945577429892911appendonsend"></div>
<hr style="display:inline-block;width:98%">
<div id="m_-2345945577429892911divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> valhalla-dev <<a href="mailto:valhalla-dev-retn@openjdk.org" target="_blank" rel="noreferrer">valhalla-dev-retn@openjdk.org</a>> on behalf of Pedro Lamarão <<a href="mailto:pedro.lamarao@prodist.com.br" target="_blank" rel="noreferrer">pedro.lamarao@prodist.com.br</a>><br>
<b>Sent:</b> Wednesday, September 10, 2025 11:11 AM<br>
<b>To:</b> Stephen Colebourne <<a href="mailto:scolebourne@joda.org" target="_blank" rel="noreferrer">scolebourne@joda.org</a>><br>
<b>Cc:</b> valhalla-dev <<a href="mailto:valhalla-dev@openjdk.java.net" target="_blank" rel="noreferrer">valhalla-dev@openjdk.java.net</a>><br>
<b>Subject:</b> Re: Method names for Valhalla value types</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div dir="ltr">Em qua., 10 de set. de 2025 às 11:54, Stephen Colebourne <<a href="mailto:scolebourne@joda.org" target="_blank" rel="noreferrer">scolebourne@joda.org</a>> escreveu:</div>
<div>
<div> </div>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
1) Basic - add/subtract/multiply/divide/negate<br>
Used by BigDecimal/BigInteger<br>
</blockquote>
</div>
<div><br>
</div>
<div>To me, style 1 communicates "update" -- x.add(y) -- add y to x, update x by adding y.</div>
<div>It would confuse me if "add" did not update x.</div>
<div>Following Stepanov in "Elements of Programming", I think of this as "accumulator style".</div>
<div><br>
</div>
<div>For immutable data types, I think style 2 communicates "new value".</div>
<div>In my own arithmetic code, I use sum, difference, product, quotient and remainder; division produces a pair; inverse, half, twice or double etc.</div>
<div><br>
</div>
<span>-- </span><br>
<div dir="ltr">
<div dir="ltr">
<div>Pedro Lamarão</div>
</div>
</div>
</div>
</div>
</div>
</blockquote></div></div></div>