Are generics specialized during compilation or they are just like java generics only for compile time checks?
generics, swift
Solution
Swift starts by compiling a single implementation that does dynamic type checking, but the optimizer can then choose to clone off specialized implementations for particular types when the speed vs code size tradeoffs make sense. Ideally, this gets 90% of the speedup of always cloning, without the code size and compilation time exploding.
Problem
There are three ways to implement generics: Just a tool for compile time checks, but every template instance is compiled to the same byte/assembly code implementation (Java, as noted in comments "type erasure" implementation) Each template instantiation is compiled to specialized code (C++, C#) Combination of #1 and #2 Which one is implemented in Swift?