Blame Prediction

Static type systems are usually conservative. Therefore, many interesting programs are rejected by the static type system, even though they may execute without errors. Dynamic type systems allow such ill-typed programs to run, at the cost of run-time errors. The cause of runtime errors is often far removed from the place where the type errors are raised, making the program hard to debug. We present a novel typing discipline called blame prediction which transforms programs in order to detect runtime type errors as soon as they are guaranteed to happen. These type errors relate the future type error with its cause, aiding in debugging. As a proof of concept, we have applied blame prediction to a functional Scheme-like language and evaluated our system against soft typing.