3 ms·
There are two meanings of "type erasure". One concerns the user, the other the compiler writer. When most users people ask about type erasure, they ask whether
by 4ad 5y ago
There are two meanings of "type erasure". One concerns the user, the other the compiler writer.
When most users people ask about type erasure, they ask whether types are erased when compiling the reflection information for polymorphic values (like Java does). Go doesn't have polymorphic values, so the question doesn't apply.
Type erasure means something more general than that to compiler people. Type erasure refers to whether you can compile code while erasing its type, and it's generally a useful property. In general statically-typed programming languages are implemented with type erasure, while dynamically-typed languages are not. Of course, since Go has reflection, it can't do type erasure. Interfaces also conflict with type erasure somewhat, though as expected, during the code generation types are erased as much as possible.
As a comparison, Rust does type erasure fully.