3 ms·
Neat. It seems to me like this is filling three separate gaps: - fixed point arithmetic - tagging values with units - localization for parsing currency n
by rebeccaskinner 2y ago
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.
- ackfoobar 2y ago> catch at compile time Not in this library, but I think it's possible to put the currency as a type parameter.
- eriksencosta 2y agoThe library will throw an exception if doing an operation with different currencies: https://github.com/eriksencosta/money/blob/trunk/money/src/test/kotlin/com/eriksencosta/money/MoneyTest.kt#L207 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!