If you mean to check arithmetic operations syntactically present in user’s code, I guess it can be done already with a module exporting checked version of these operations? You can put using CheckedArithmetics
(say) in the beginning of the module (maybe with if ENV["CHECK_ARITHMETICS"] == "true" ... end
so that it’s easier to turn on/off). I used the same trick to change the associativity of *
.