3 ms·
Yes, C has (very restricted) generics too. No, Go does not need to repeat all of C's mistakes.
by Nullabillity 7y ago
Yes, C has (very restricted) generics too. No, Go does not need to repeat all of C's mistakes.
- foldr 7y agoI think it's more useful to think of "generics" as applying to type systems that allow abstraction over types. C and Go crucially don't allow you to define a function that, say, appends an element of type T to an array of T. That's where things start to get complicated. C and Go don't have a restricted version of that [1] - they just don't have it at all. [1] With the largely irrelevant exception of the C11 _Generic stuff.