lambdista/money

Can't do Money division by Money...?

Closed this issue · 3 comments

Nifty DSL! Kind of surprised you can't do this tho...

val a = 1(USD)
val b = 2(EUR)
val c = a / b

Although this works...

val c = a / b.value

Thank you.

Also in real life, you divide money by normal numbers not other money. What should 1 USD / 2 EUR give you?

With your DSL, I think that makes sense. In the real world, we divide by currencies to perform on the fly rate comparison... you already handle that by allowing us to divide different currencies directly. So, good point. E.g. I might do "$100 / €88" to compare a US amount to a Euro amount, and find out if it is above or below conversion. Obviously, this is ~1.13 so it's "less expensive" than today's real conversion... Anyhow, kind of a rare thing to do.

Yeah kind of rare and when it comes to API design, you know, when in doubt leave it out. :-)