Type Safety
Appearance
Type safety is the property of a programming language's type system that prevents operations from being applied to values of incompatible types — that a string cannot be added to an integer, that a null pointer cannot be dereferenced as if it were a valid object, that a function expecting three arguments cannot be called with two. It is the formal guarantee that the abstractions the programmer uses to reason about code correspond to the actual runtime behavior of that code. Where memory safety protects the machine from the program, type safety protects the program from itself.
The guarantee is not merely practical but epistemic. A type-safe language makes the claim: if