This comment on ycombinator lives rent-free in my head. Nothing before or since has captured my feelings on Go quite as succinctly. For the first ten

Are Golang Generics Simple or Incomplete? A Design Study

submited by
Style Pass
2024-11-22 21:00:06

This comment on ycombinator lives rent-free in my head. Nothing before or since has captured my feelings on Go quite as succinctly.

For the first ten years of Golang's life, it didn't support generics. This was a deliberate decision by the language authors, defended on the basis of avoiding unnecessary complexity.

But inevitably, Go caved to demand and added generics in March 2022, with version 1.18. This decision was met with a lot of pushback by Go devs who strongly felt that generics are unnecessary.

At DoltHub, we use generics in our code when we think that they reduce code duplication, make code clearer, or improve performance along critical paths. We think that generics can be used to write very clean code. We also know they also be used to write messy code.

And yet, generics in their current form feels like a compromise that pleases no one. I'm not the first person to feel this way either.

Leave a Comment