Hacker News new | ask | show | jobs
by wice 1998 days ago
These are not the only alternatives. E.g.:

- introduce a non-zero number type, define division as Number/NonZeroNumber -> Number, and provide a simple, non-verbose way to convert a Number into NonZeroNumber (with default value in case of zero, and/or direct assignment after a non-zero-check)

- optionally introduce an unsafe division operator that takes two Numbers and returns Option[Number]