4 ms·
How were maps generic before generics, I am not sure I understand. Didn’t you still have to declare them as map[type1]type2?
by cdelsolar 3y ago
How were maps generic before generics, I am not sure I understand. Didn’t you still have to declare them as map[type1]type2?
- ghusbands 3y agoSo when something is generic, it means it is a type parameterized by other types. So the type map[string]int is indeed generic, but no language users could create their own type btree[X]Y, for example. Essentially, the go developers saw a need for generics and then decided that only they get to create them, where most modern language developers either make them available for everyone to implement or don't add them at all.