Hacker News new | ask | show | jobs
by bascule 4288 days ago
The lack of generics is definitely a problem. You can't write generic code, and end up having to write your own thunks for each type you want to use. The standard library can't expose generic facilities that work on any type.

This should be evidenced by the fact that Go is the only mainstream statically typed language without parametric polymorphism. Worse, trying to bolt it on after the fact has generally lead to ugly solutions, like C++ templates or Java's generics.

I expect Go will eventually follow Java's lead and bolt on generics awkwardly.

1 comments

> The lack of generics is definitely a problem.

Not to me. Not to the author of this article.

> I expect Go will eventually follow Java's lead and bolt on generics awkwardly.

Nope. They'll either be done right or not at all. We're not ignoring Java's mistakes.

I guess you're a fan of rewriting type thunks over and over and over again, and don't care about the standard library implementing functionality or reusably. Whatever floats your boat, but in both C++ and Java people got tired of writing type-thunking boilerplate over and over again and eventually got features added to the language to fix the problem.

At this point I'm not sure how Go can do generics well, so if "right or not at all" is really the bar, then Go will probably never get them.