News for hackers. Stuff that matters.
Re:Kotlin Money by rebeccaskinner on Tuesday October 08, 2024 @12:45PM (#41779261)
Neat. It seems to me like this is filling three separate gaps:

  - fixed point arithmetic
  - tagging values with units
  - localization for parsing currency names into units
I'm curious if Kotlin's type system is expressive enough to allow you to catch at compile time cases where you might be trying to, e.g. add USD to GBP.
Re:Kotlin Money by eriksencosta on Tuesday October 08, 2024 @02:43PM (#41780432)
The library will throw an exception if doing an operation with different currencies: https://github.com/eriksencosta/money/blob/trunk/money/src/t...

But I think I'll make it explicit in the documentation. Thanks for pointing out!

Re:Kotlin Money by ackfoobar on Tuesday October 08, 2024 @01:40PM (#41779832)
> catch at compile time

Not in this library, but I think it's possible to put the currency as a type parameter.