5 ms·
I'd say either resort to code generation or pick another language that fits better your use-case.
by emersion 8y ago
I'd say either resort to code generation or pick another language that fits better your use-case.
- bunderbunder 8y agoYeah, sorry if I wasn't being clear. That's pretty much the line I was thinking along. It's perfectly fine for Go's answer to be, "Go doesn't have generics because generics aren't needed to solve the kinds of problems Go is designed for solving, and we are not trying to be a kitchen sink language here. If generics are something you need, please pick a language that's designed to solve the problems that you're trying to solve." But that's a far cry from what TFA said. TFA read more to me as, "Go doesn't have generics because generic programming is a half-baked idea that isn't ready for prime time."
- bunderbunder 8y agoOr, to throw a third option one out there -- "Go doesn't have generics because they would interact poorly with some other aspect of the language." That works, too. For example, it's why F# continues not to have ad-hoc polymorphism, despite many users clamoring for it. I'm inclined to agree with the project's maintainers on the subject. As useful a thing as it is, and as glaring as it is for a modern descendant of ML not to have it, it's hard to see how it could be added without creating all sorts of language warts.
- louthy 8y agoBoth F# and C# can do ad-hoc polymorphism - I use it in my language-ext library [1], the library is C# but the principle is the same for F#. It's not idiomatic (or pretty), but it's possible if needed. Higher-kinds is the killer missing feature. [1] https://github.com/louthy/language-ext#ad-hoc-polymorphism https://github.com/louthy/language-ext#ad-hoc-polymorphism
- llimllib 8y ago> I think Go should be comfortable not being suitable for writing certain classes of programs. I don’t think programming languages should compete with each other in an attempt to become the perfect solution to every problem. This is impossible, and attempts will just create a messy kitchen sink that solves every problem poorly. is a quote from the article, and seems to say exactly what you're saying?