from Hacker News

What Go Might Be Like With Generics

by sentiental on 1/19/14, 11:50 PM with 48 comments

  • by Sir_Cmpwn on 1/20/14, 2:38 AM

    Is the only argument that Go users can come up with against generics is that they don't like the syntax? The pretentious nature of the Go community really puts me off from the language, especially when combined with some of the pretentious designs of Go itself.
  • by f2f on 1/20/14, 2:27 AM

    is this trying to solve a particular problem or just pandering to the "... but generics!" crowd of trolls?

    because it doesn't look like it's solving anything, it feels positively ugly, and there's no way we'll every shut those people up no matter how hard we try. there's no generics solution that will do that.

    thankfully go's authors don't usually favour the internet's opinion on these matters, or we'd be dealing with something even uglier now.

  • by rollo on 1/20/14, 3:11 AM

    Eventually those who need static typing and parametric polymorphism will switch to Haskell anyway, where both are done in a much better way, both syntactically and implementation wise.
  • by bvaldivielso on 1/20/14, 2:12 AM

    It is undeniable that generics are a quite demanded feature for golang.

    We'll see how the language evolves, but I can't see them coming for a "long" time.

  • by chimeracoder on 1/20/14, 3:35 AM

    I have been writing Go daily at work for about a year and a half. It is now my primary language, and my default choice for any new projects, the way Python used to be. Before that, I come from a background in functional programming (and still find functional programming to be my favorite paradigm).

    It seems to me that there are two disjoint sets of people: those who write Go regularly, and those who complain about generics in Go.

    Of course, you can interpret this either way you wish!

    1) Perhaps those latter people would like Go despite its lack of generics if they only bothered to get familiar with idiomatic Go.

    2) Perhaps the lack of generics is precisely what prevents them from writing Go on a daily basis.

    But as someone who actually does write Go on a daily basis, and has for a year and a half, I can honestly say that I've only ever missed them a handful of times. And I say this as a functional programmer who is used to being able to call "map" everywhere.

    In fact, if I had to prioritize the things that I wish I could change about Go, generics would not be in the top three - not even in the top five[0]. They're just really something that I don't miss anymore.

    [0] I could tell you what they are, but that'd be making it too easy - give Go a shot, long enough to realize you really don't need generics as much as you think you do, and then you'll probably have a good idea of the good, bad, and ugly when it comes to Go.

  • by fiorix on 1/20/14, 2:20 AM

    <T>errible to my eyes.
  • by mseepgood on 1/19/14, 11:59 PM

    tl;dr: <T>
  • by embwbam on 1/20/14, 3:25 AM

    I use generics every day in typescript. I'm waiting to use go until it has them.
  • by reality_czech on 1/20/14, 5:48 AM

    I'm more interested in what Go might be like without whiners.