Em qua., 10 de set. de 2025 às 11:54, Stephen Colebourne <
[email protected]> escreveu:


> 1) Basic - add/subtract/multiply/divide/negate
> Used by BigDecimal/BigInteger
>

To me, style 1 communicates "update" -- x.add(y) -- add y to x, update x by
adding y.
It would confuse me if "add" did not update x.
Following Stepanov in "Elements of Programming", I think of this as
"accumulator style".

For immutable data types, I think style 2 communicates "new value".
In my own arithmetic code, I use sum, difference, product, quotient and
remainder; division produces a pair; inverse, half, twice or double etc.

-- 
Pedro Lamarão

Reply via email to