11:55
<Jesse>
tbh I think, at least in the short term, a Math.decimalAdd etc. would be more ergonomic than the current approach, which would require news and then a final toString, but that's misleading because it's a completely different approach
11:56
<Jesse>
looking at a possible future where decimals are a new primitive type (or exist somehow as sugar), then yes, they would be more ergonomic
11:57
<nicolo-ribaudo>
tbh I think, at least in the short term, a Math.decimalAdd etc. would be more ergonomic than the current approach, which would require news and then a final toString
I think this depends a lot on whether you are just doing one operation, or a series of operations
11:58
<Jesse>
what I find awkward about the Math.decimalAdd etc. approach is that it's all about strings; this feels conceptually off to me. I think of decimals as numbers
11:58
<Jesse>
right -- and we want to keep calculation in the forefront, not merely conversion to/from strings
11:59
<Jesse>
I like the idea of triaging the issues
12:00
<littledan>
do you really think so? I think it's meaningful to have decimal as a data type, and this discourages errors
12:01
<Jesse>
I was trying to suggest that both approaches are bulky; and Nic's point about arithmetic is imo a stronger point
12:02
<littledan>
I think bulkiness isn't really the main thing to focus on here; we want to reduce errors by making a well-typed interface.
12:10
<Jesse>
it seems odd to me to enable decimal arithmetic but not have decimal numbers
12:11
<Jesse>
iow I see it not just as an ergonomic concern
12:14
<Jesse>
but just to wrap up this line of thinking, my intention was to say that, in that one example, focusing on ergonomics is misleading
12:20
<Jesse>
indeed, since we expect one main use cae to be doing calculations, I think if we were to pursue the Math.decimalXYZ idea developers would quickly see their code size grow. It seems more natural to me to have entities in the language (decimals) that we can directly work with, rather than stuff the semantics of those entities into static methods
16:43
<sffc>

Math.decimalAdd is an exercise to demonstrate that we don't need IEEE 754 Decimal128 in the data model of the language in order to represent decimals and have decimal-like arithmetic in the language. We could do it with all of our existing utilities. I don't disagree with the points about a new type discouraging errors; I put that in the ergonomics bucket.

The reason I wanted us to do this exercise is because I think we need to be much more clear on why we are proposing this specific shape of proposal. It isn't because there aren't other ways to solve the same problem; it is because we believe that a new type system surrounding decimal numbers will help developers write better, more accurate code.