3 ms·
If void pointers are "generics" as you say, then the word is pretty much meaningless. Every language I know of supports that kind of construct and you can usual
by ben-schaaf 8y ago
If void pointers are "generics" as you say, then the word is pretty much meaningless. Every language I know of supports that kind of construct and you can usually dump it everywhere as much as you like.
Generics specifically refer to the parameterization of types using types. Go doesn't have user defined generics.
The only reason in C++ why you need to define all the "internal details" in the header file is because the compiler needs to know the size of things. You can write completely template free code that requires all your classes to be defined in headers or you can litter your code with templates, put pointers everywhere and place all your classes outside of headers. It has nothing to do with generics and everything to do with how the rest of C++ is designed.
- jstimpfle 8y agoThanks for the correction, I shouldn't say "generics". But rather "Go programmers don't have user-defined generics, they use interface{}" or something along those lines. Other than that, I don't think we're in disagreement here.