Earlier quoted context omitted.
Any successor to C needs to be type-safe. Generics make that easier.
Why? C isn't type-safe.
A Proposal for Adding Generics to Go
31–40 of 273 posts
Re: A Proposal for Adding Generics to Go
#32How many different proposals for generics have there been?
The previous one was confusing as F and the antithesis of the simplicity Go claims it abides by. It felt very much like a plot to add generics without ever using the word generics anywhere and looking too much like Java/C#/...
The current proposal is basically what you'd expect from generics in a programming language, but a bit more limited.
It took basically 10 years, a generation of developers, to quell the opposition against generics in Go, to end up with generics...
They might even have unknowingly followed the ADA implementation except that Go's type inference makes them even easier to use.
> To use a generic type, you must supply type arguments. This is called instantiation.
https://go.googlesource.com/proposal/+/refs/heads/master/des...
This is basically how generics as packages in ADA works. I would add that ADA solved many existing problems in Go decades ago...
https://en.wikibooks.org/wiki/Ada_Programming/Generics
> The generic procedure can be instantiated for all the needed types.
Now all Go needs to do is to look at how Ada tasks work in order to fix every single issue with Go routines...
Re: A Proposal for Adding Generics to Go
#33Earlier quoted context omitted.
Why? C isn't type-safe.
C doesn’t lack safety by-design - it’s hobbled by its history and constraints imposed by its userbase - otherwise C would have major breaking changes more often.
Edit: formatting
Re: A Proposal for Adding Generics to Go
#34I 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.
Re: A Proposal for Adding Generics to Go
#35We 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,…
Re: A Proposal for Adding Generics to Go
#36We 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,…
This is not the first time I argue this case, but I would go a step further and say that not having generics is feature of Go. There are plenty of languages out there with Generics. I use several of them. I use Go when that suits me, and it's typically for cases where high readability trumps doing a lot of magic with generics. I think only once or twice have I thought to myself, "this would have been better with Gene…
Re: A Proposal for Adding Generics to Go
#37Re: A Proposal for Adding Generics to Go
#38Re: A Proposal for Adding Generics to Go
#39Re: A Proposal for Adding Generics to Go
#40How many different proposals for generics have there been?
IMO This is something that can't be done by a committee of so called industry players.