Live data from Hacker News

A Proposal for Adding Generics to Go

blog.golang.org

11–20 of 273 posts

Re: A Proposal for Adding Generics to Go

#11
We have a very large Go codebase here at Stream and not having generics is just not really as big of an issue as you think it is. There are plenty of work arounds if you get used to not having generics in the language. The fast compile times of Go are amazing. I was doing some Kotlin a few weeks ago and the difference is crazy. Go: Install deps, compile everything done in 5s. Doing the same in Kotlin, laptop freezes, android studio freeze, time to get a coffee :)

That being said it would be really nice to have some reusable map type structures that handle GC better than the default maps. Fingers crossed.

Re: A Proposal for Adding Generics to Go

#14

I hope at some point they manage to add it. I, however, discovered Rust in the meanwhile. It has generics. And it is not too complex either and has quite a few other bonuses.

I like Go, but I too in the meantime have dipped my toes into Rust and it's just so much better without being that much more complex. The learning curve is real but quite a bit overstated I think.

Re: A Proposal for Adding Generics to Go

#16

We have a very large Go codebase here at Stream and not having generics is just not really as big of an issue as you think it is. There are plenty of work arounds if you get used to not having generics in the language. The fast compile times of Go are amazing. I was doing some Kotlin a few weeks ago and the difference is crazy. Go: Install deps, compile everything done in 5s. Doing the same in Kotlin, laptop freezes,…

I actually just need generic Sets.

Generic map/reduce on slices wouldn't hurt too.

OTOH, it's 2021 and look at what we are wishing. My love/hate relationship with golang is like the one I have with Apple.

Re: A Proposal for Adding Generics to Go

#17

As much as I've cursed the lack of generics and the limited expressiveness of Go's type system, it's hard for me to reconcile these proposals with what I know of Go. Go was conceived as a small language, a successor to C, and purposely eschewed "new-fangled" features of modern languages. Whether the result is good is a matter of taste, but I feel that retroactively bolting on a modern type system will simultaneously…

One could argue that parametric polymorphism is a form of simplicity, because it disentangles algorithms from concrete types.

Re: A Proposal for Adding Generics to Go

#18

As much as I've cursed the lack of generics and the limited expressiveness of Go's type system, it's hard for me to reconcile these proposals with what I know of Go. Go was conceived as a small language, a successor to C, and purposely eschewed "new-fangled" features of modern languages. Whether the result is good is a matter of taste, but I feel that retroactively bolting on a modern type system will simultaneously…

The lack of generics makes it only more complex.

Simplicity: yes, but in a senseful manner. Omitting generics is not senseful to me.

Re: A Proposal for Adding Generics to Go

#19

I hope at some point they manage to add it. I, however, discovered Rust in the meanwhile. It has generics. And it is not too complex either and has quite a few other bonuses.

I would say that in the case of Rust, generics are on the list of those "few other bonuses". There are other things in Rust that are more attractive and innovative. Rust is as complex as C++ (which is not a compliment) but saner and safer, without undefined behavior. Though, at the rate they add new features, I can see it becoming rapidly a kitchen sink.

Re: A Proposal for Adding Generics to Go

#20
post #10

Another comment mentions this is the third (serious) attempt at adding generics to Go. Is there any concise history of these attempts (including this one)? I'd like to understand the gist of these proposals and what ultimately derailed them. By themselves these proposals are pretty inscurtable.

The golang nuts mailing list archive might be the best place to start. https://groups.google.com/g/golang-nuts
Post reply on HN