in case it wasnt clear: a zero share tx being a tombstone is a stock accounting convention, not a choice of that particular software project.
type Record {
NShares(n: Int)
ZeroTheAccount()
}
fn parse_record(n: Int) -> Record {
case n {
0 -> ZeroTheAccount()
_ -> NShares(n)
}
}
Then you don't have to worry about mixing up the two :)to wit: anything that calculates an average over non-fixed data cardinality for business logic is potentially at risk for a seroious logic error in gleam.
what's worse is this is a nonobvious error. llms will likely make it a lot. a code review is likely to miss it.
what's even worse is that the author refuses to acknowledge this and digs deeper in (because, well, its a "principled" choice that got made and now to change is breaking and it breaks a core "feature" of the language). 1/0 = 0 is fine for a language like idris which is used for theorem proving but never used for real world things. It's inappropriate for deploying when, for example, real money might be at stake.