4 ms·
> I like generics, but why can't there be a language that doesn't have them? Python,Ruby and Javascript don't have generics ... because they are dynamically ty
by camus2 10y ago
> I like generics, but why can't there be a language that doesn't have them?
Python,Ruby and Javascript don't have generics ... because they are dynamically typed. Go has generics, maps and array are container types, you just can't define your own. To say Go has no generics is stupid, it just doesn't allow you to define your own. Instead you can use catch all interface{} everywhere like dynamically typed languages.
> Not every language has to have generics, when I want to use them, I simply switch languages.
This statement makes no sense at all.
- AsyncAwait 10y ago> Go has generics, maps and array are container types, you just can't define your own. To say Go has no generics is stupid, it just doesn't allow you to define your own. That's usually what is indeed meant by the statement "Go doesn't have generics", maybe it should be "Go doesn't have user-defined generics", but I assume most people can infer that. I really hate the recent trend of having to spell everything out. > This statement makes no sense at all. Can you be more specific? What doesn't make sense at all in saying that when I have a simple problem that is unlikely to benefit greatly from a more sophisticated type system, I reach for Go, otherwise I use a different language?