<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
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);" class="elementToProof">
<br>
</div>
<div style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Chen</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> valhalla-dev <valhalla-dev-retn@openjdk.org> on behalf of Pedro Lamarão <pedro.lamarao@prodist.com.br><br>
<b>Sent:</b> Wednesday, September 10, 2025 11:11 AM<br>
<b>To:</b> Stephen Colebourne <scolebourne@joda.org><br>
<b>Cc:</b> valhalla-dev <valhalla-dev@openjdk.java.net><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">scolebourne@joda.org</a>> escreveu:</div>
<div class="x_gmail_quote x_gmail_quote_container">
<div> </div>
<blockquote class="x_gmail_quote" 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 class="x_gmail_signature_prefix">-- </span><br>
<div dir="ltr" class="x_gmail_signature">
<div dir="ltr">
<div>Pedro Lamarão</div>
</div>
</div>
</div>
</div>
</body>
</html>