2 ms·
> The map is what is generic, not a specific map. List<Int> is not "compatible" with a List<Char> in any implementation of generics; how could it be? What would
by laumars 12y ago
> The map is what is generic, not a specific map. List<Int> is not "compatible" with a List<Char> in any implementation of generics; how could it be? What would that even mean?
Well, arguably there are languages where that's possible. PHP does some odd things with maps and arrays, and Perl hashes don't have any distinctions between strings, integers nor floats (or at least none that I've run into - please correct me if I'm wrong). Though I will grant you that I'm now comparing strongly typed languages to weakly typed ones.
I think my problem here is although I cut my teeth on statically typed languages, my exposure to generics in those languages was rather limited (in fact does Pascal even support generics?). So I'm possibly misunderstanding the usage of generics in modern strongly typed languages.