Type erasure


In programming languages, type erasure is the load-time process by which explicit type annotations are removed from a program, before it is executed at run-time. Operational semantics that do not require programs to be accompanied by types are called type-erasure semantics, to be contrasted with type-passing semantics. The possibility of giving type-erasure semantics is a kind of abstraction principle, ensuring that the run-time execution of a program does not depend on type information. In the context of generic programming, the opposite of type erasure is called reification.

Type inference

The reverse operation is called type inference. Though type erasure can be used as an easy way to define typing over implicitly typed languages, it does not always lead to an algorithm to check implicitly typed terms.