4 ms·
My only complaint is that there seems to be too much infix. Why not just do 50.btc, 25.3.usd This would keep it inline with the time API doing 20.seconds Also p
by Exerosis 2y ago
My only complaint is that there seems to be too much infix. Why not just do 50.btc, 25.3.usd
This would keep it inline with the time API doing 20.seconds
Also percentages could be standard library if you ask me but would probably also need to be 2.3.percent.
Looks cool, always happy to see Kotlin love!
- eriksencosta 2y agoThanks for commenting. I'm still learning Kotlin and I overlooked the usage of get() with vals. This will be the next syntactic sugar into the mix. I think it makes sense. When I was designing the API, I created methods like toUSD() and toEUR(). But with 306+ circulating/tender currencies and 2000+ cryptocurrencies, I thought it could lead to a bad experience when using code completion.
- eriksencosta 2y agoWhat do you think of this? https://github.com/eriksencosta/money/blob/enum-percentage-spike/money/src/test/kotlin/com/eriksencosta/money/DesignSpikes.kt#L13 https://github.com/eriksencosta/money/blob/enum-percentage-s... It is a (quick) spike solution, but I've implemented the currency codes as enums and added support for 20.percent. Not so sure about supporting 50.btc and 25.3.usd. I need to check if doing so would affect code completion.