Hacker News new | ask | show | jobs
by tempodox 1739 days ago
Generics are the polar opposites of automatic casting. They exist so you don't have to shoehorn one argument type into another.

JS isn't exactly the best environment to understand this. Ideally, use a compiler language that can show you the generated assembly (`gcc -S ...` with C++ for instance). Then you can see first-hand how type-specific implementations of a generic function look like.