Generics everywhere

JVM, .NET, C++ – all those technologies support generic-like code reuse. They allow us to write strongly typed code just once and reuse it for multiple types. Even though this sounds easy, generics are actually quite complicated under the hood and each platform implements them differently.

We will see different approaches for implementing generics. We will compare reification in .NET, type erasure in JVM and templates in C++. We will see why stronger type system sometimes is less powerful and why casting everything to object in Java can be better then storing a concrete type in .NET. We will see what had to be done to support generics in .NET and why they were not available since the very beginning.

Level 200. Moderately intense session.



.NET Inside Out Part 10 — Using type markers for low level optimizations

Presented at