The Blog of Boban Acimovic
  • Blog
  • Categories
  • Tags
  • Series
  • Links
  • About
  • Contact
  • RSS
  • Terms
  • Privacy

Generics

Carpe Diem

go

Check type of generic parameter in Go

Go is over ten years old language but generics (type parameters) are introduced just in the March this year. Hence, still lot of developers avoid using them or have certain problems once decided to give it a try. One of the common problems is how to check the concrete type of a generic parameter, specially of non constrained parameters. So, if you try to do the following, it won’t work:

  • Boban Acimovic
Boban Acimovic 3 December 2022 • 2 min read
Go

Upcoming Go's generics

In the very early adoption of Go by the open source community, lot of developers already suggested the lack of generics. However, some other claimed that simplicity of Go shouldn’t be compromised by generics. Few days ago, the never ending discussions pro and contra generics are finally over. The proposal is accepted and we can expect generics in Go 1.18 somewhere in spring of 2022. You may wonder why does it take that long, but this is not just about the compiler but also some parts of the standard library may need to be rewritten in order to replace the old code which could benefit from generics.

  • Boban Acimovic
Boban Acimovic 26 February 2021 • 5 min read
The Blog of Boban Acimovic © 2022
Latest Posts