How would you define the outcome of signed integer overflow? How would that definition make code that (inadvertently) induces signed integer overflow better?
Make it signal. That makes code better b/c you can now handle the error case consistently across platforms.
Alternatively, a sufficiently advanced type system could enforce compile time restraints in such a way that unmitigated potential overflows won't compile.
There's a lot of different ways that a language could handle this situation.
... would be unwieldy. Languages have tried this and you find yourself working around the type system.
Maybe you find yourself working around advanced type systems, but I generally find the more advanced the type system the more my productivity is enhanced.
Sometimes (often) numbers are just numbers.
Until they under/over-flow and/or the compiler decides to optimize away important part of your program, and then it's a huge problem in addition to being "just numbers".
1
u/industry7 May 31 '17
Make it signal. That makes code better b/c you can now handle the error case consistently across platforms.
Alternatively, a sufficiently advanced type system could enforce compile time restraints in such a way that unmitigated potential overflows won't compile.
There's a lot of different ways that a language could handle this situation.