4 ms·
A reminder that this still isn't the correct way of handling money. The correct way is to put it in the type-system [1]. All the best, -HG [1] https://web.ar
by halosghost 3y ago
A reminder that this still isn't the correct way of handling money. The correct way is to put it in the type-system [1].
All the best,
-HG
[1] https://web.archive.org/web/20211014094900/https://ren.zone/articles/safe-money https://web.archive.org/web/20211014094900/https://ren.zone/...
- runeks 3y agoThis only puts currency codes in the type system; and uses rational numbers for amounts. This is definitely useful because you can have the type system tell you if you've implemented e.g. exchange rate conversion incorrectly. But it's also a hassle because you need to reify currency values discovered at runtime as types, which isn't pretty [1]. [1] https://github.com/runeksvendsen/order-graph/blob/eef0006cba7aea019611063d648b0e9915644820/src/OrderBook/Graph.hs#L49-L64 https://github.com/runeksvendsen/order-graph/blob/eef0006cba...
- jorangreef 3y agoYes, and to your first point, TigerBeetle also supports multiple ledgers, explicitly where each ledger is for a separate unit or currency (with isolation enforced by TigerBeetle across different units/currencies). Thus, TigerBeetle doesn't preclude the use of money types at a higher layer (you would have seen that we tried to emphasize this also in the post). Another way to think of this, is that we focus on the storage of accounting information by providing high-performance accounting primitives (e.g. execute 8k double entry transactions all within 5ms in a single network roundtrip DB query). But the accounting policy (rounding etc.) remains the responsibility of the application/organization, since this may differ according to requirements/jurisdiction.