type erasure

"Type erasure" is a concept used in programming to simplify and generalize code by removing specific type information during runtime.

πŸ‡ΊπŸ‡Έ US Voice:
πŸ‡¬πŸ‡§ UK Voice:

Definition

C1Programming

(technical)The process of removing explicit type information from a program before it runs, ensuring type safety during compilation but not at runtime.

Example

  • Type erasure allows Java to use generics without creating new classes for each parameterized type.

C1C++ Programming

(technical)A technique that allows a class to be generic without requiring compile-time template arguments, achieved by using a custom interface and templates.

Example

  • In C++, type erasure can be used to enable polymorphism without explicit type information at runtime.

Similar

Terms that have similar or relatively close meanings to "type erasure":

existential type