Re:Untyped Programs Don’t Exist
by joshuamorton on Friday December 07, 2018 @02:17AM
(#18625731)
Not necessarily, additional and subtraction just return int, but you can define other operations over subsets of ints that return nonzero.
Rust does something similar, floats by default can be NaN, but you can write a non-NaN float that just panics if it's Nan and then ignore the possibility of Nan in parts of your system.
In reality I think it would be too cumbersome. Division by zero is a relatively rare flaw and zero agnostic math on integers is common. I'd love to hear about any languages that do this.