julia> using SaferIntegers
julia> @saferintegers begin
typemax(Int) + 1
end
ERROR: OverflowError: 9223372036854775807 + 1 overflowed for type Int64
Stacktrace:
[1] throw_overflowerr_binaryop(::Symbol, ::Int64, ::Int64) at ./checked.jl:154
[2] checked_add at ./checked.jl:166 [inlined]
[3] + at /home/mason/.julia/packages/SaferIntegers/lLDKG/src/arith_ops.jl:21 [inlined]
[4] +(::Int64, ::SafeInt64) at /home/mason/.julia/packages/SaferIntegers/lLDKG/src/arith_ops.jl:71
[5] top-level scope at REPL[31]:2
This way, these things are explicitly caught and you can use more appropriate number types.