3 ms·
That's probably more a matter of taste. Go has a reflect package which allows the programmer to determine type at runtime, making generics unnecessary. It may
by firebrand39 12y ago
That's probably more a matter of taste. Go has a reflect package which allows the programmer to determine type at runtime, making generics unnecessary.
It may not be as convenient and familiar as generics.
Here is an example http://play.golang.org/p/a18VESulWS http://play.golang.org/p/a18VESulWS
- coldtea 12y ago>That's probably more a matter of taste. Go has a reflect package which allows the programmer to determine type at runtime, making generics unnecessary. That's not "making generics unnecessary". That's "using an ugly hack that throws typesafety away instead of a proper solution". And it's more familiar than generics, that's what Java had before they understood that they had to have generics.
- firebrand39 12y agoWell, you are right it reminded me of method overloading. Otherwise I think time will tell. In the end generics are just types with parameters, for creating typed permutations _at_compile_time_ of functions/maps etc.. And as you said, java worked quite a while without them.