Re:Untyped Programs Don’t Exist
by clhodapp on Thursday December 06, 2018 @10:24PM
(#18624905)
Division by zero isn't necessarily a runtime error. You could define your division operation to only admit divisors that are statically known not to equal zero. You just need a type system that is strong enough to track whether a number has been confirmed not to equal zero.
[ Parent
| on HN ]
(Only problem is that such a type system is unwieldy compared to mathematics itself.)
I suppose we’d better get you in contact with with all those silly mathematicians who like to use proof assistants to add rigour to their work.
In run of the mill mathematics, I've never seen zero treated as a special type. In derivations, a restriction against zero (because some variable appeared in a denominator) is usually carried as a logical assertion that is attached to subsequent derivations, like "<.. equation ...>, x /= 0".