Why Ledger Libraries Should Not Define Their Own Money Type
A software developer argues that most ledger libraries create unnecessary complexity by shipping their own Money class, forcing systems to maintain two competing money types and a conversion layer. Drawing on payment systems work since 2018, the author identifies multiple points where amount-currency bindings can silently break during data transformations. To address this, they built a library called ledger-core that accepts any value satisfying a minimal MoneyLike protocol rather than defining its own money class. The protocol requires just two properties and four arithmetic operations, deliberately excluding multiplication and division to keep the ledger focused solely on posting and netting. The core principle is that each system should have exactly one money type, provided by a dedicated currency library and consumed by all other components.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in