by mastrsushi · 5y ago · 0 comments
I'm happy generics are coming to Go, but living without them hasn't been difficult. (Like the article author, I feel like I'm jumping through more ugly hoops due to lack of a proper enum type than I am due to lack of generics.)
Programming languages are a human phenomenon, as is their success. They are popular in spite of their flaws, not because of them.
As a web engineer you should look at rescript/reason before making claims about compile times.
If you look at Java and C#, neither had generics either. You used casts, just like Go. It's safe, because the casts are safe (unlike void pointers). People started using Java and C# anyway, even though they didn't have generics.
Java then added generics in J2SE 5.0, which came out in 2004, when Java was nearly 10 years old. A year later, in 2005, C# added generics as well, with the release of C# 2.0.
Given that Go is about 11 years old now, it doesn't seem so out of place.
That is one of the reasons why the CLR already had most of the infrastrucure for proper handling of generic code instead of being a compiler only sugar.
"How generics were added to .NET"
https://mattwarren.org/2018/03/02/How-generics-were-added-to...
Also many system-ish programs, CLIs and the like also don't really need complex structures or benefit from authoring them + the algorithms that traverse them in a program-specific way.
That said, I'm not a fan of Go but generics are far from the only reason why I'm not a fan and it could probably exist as a somewhat useful language without them indefinitely.
There are times when you wish you had them, but they are typically conversion type functions. Those just don't happen that often for a lot of applications.
It's easy to show some contrived add func, and how you need one of every single number type in Go. But in practice, people rarely ever need such a function.