3 ms·
Sounds like a good use case for refinement types or general dependent types, where you can elide overflow checks if (and only if) you can prove to the compiler
by nerdponx 5y ago
Sounds like a good use case for refinement types or general dependent types, where you can elide overflow checks if (and only if) you can prove to the compiler that a computation won't overflow.
That way you can put explicit overflow checks at the boundaries of your application, and then internally you pass around compile-time "proofs" of safety and/or perform explicit overflow checks where needed.