Generics and the future direction of GoLang

I know its a little early to be making any predictions about the consequences of generics in GoLang but where do you see generics pushing the language.

Example: I’m starting to see people asking questions about data structures(Optional, Either, Seq) that are usually in the domain of functional programming. I can see why these questions are now materializing, GoLang always had great support for higher order functions and when you couple that with generics then it becomes very convenient(and easy) to implement these structures in GoLang.

Hi @G4143,

I don’t think it is too early to discuss this. Go 1.18 was released only recently but it was in beta and RC status for quite a while now, and in fact, a couple of packages that implement data structures inspired by functional programing have already hit the road.

Still, Go remains an imperative language first and foremost. Functional-programming-inspired packages may bring new useful functionalities but I see no signs that Go programming will become functional.

For functional programming, it is certainly better to use a functional language.

2 Likes

I doubt Golang will become functional but I see that path is available for some simple data structures like either, optional. etc.

For a language to really embrace functional programming, and be practical for the programmer, it has to have a convenient syntax for deep type abstractions and Golang doesn’t have that presently but I see simple functional types creeping into the language.

2 Likes

Go is now more flexible, thus is can attract more users, and solve more problems.

It also means many existing, highly used go libraries will update their code to use generics, thus it is a great time if you want to do some open source work (without pay).

1 Like