logoalt Hacker News

astrangeyesterday at 8:47 PM2 repliesview on HN

Anything with ranged numeric types. Like everyone's favorite functional programming language, Ada.


Replies

ghasltyesterday at 8:58 PM

This issue raises SIGFPE. Ada would raise Constraint_error, which is easier to catch than a signal, but still occurs at runtime.

You need range proofs to be 100% safe, and then you can as well use the regular type because invalid values will not occur.

black_knightyesterday at 8:54 PM

Or Liquid Haskell.