3 ms·
Go has generic types the same way Python has macros, or the same way C++ templates is a functional programming language. C has void *, writing generic code usi
by codr7 7y ago
Go has generic types the same way Python has macros, or the same way C++ templates is a functional programming language.
C has void *, writing generic code using it is hell. Enough so that people went through a lot of trouble creating C++ and later Rust to escape it.
I'd say the type casting from interface{} to whatever you assume is in there qualifies as different.
Pretty much every single aspect of these languages is different from what I can see, the only thing they have in common is included batteries, the rest is growing popularity and consequences thereof.
- weberc2 7y agoYeah, I get it. It’s a little disingenuous of me to say that interface{} qualifies as generics, but I can’t quite put my finger on why it is different than Python. Neither are typesafe (although mypy supports generics, but has many other issues), but in any case typesafe generics would I think improve Go.