Comment

Comment by AEVL

> First, you can have a type-checker check the currency; that doesn't have to be a runtime error: > Money<Usd> m = …; > There will, of course, be instances where you must handle currency dynamically.

With dependent types, checking for currency validity may be handled at compile-time. (This is touched upon in the post linked in the comment you replied to.)

For the case of conversion between currencies of monetary amounts:

https://github.com/anderslundstedt/type-experiments#type-saf...

parent AEVL 2 years ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton