3 ms·
This article has some good points but I'm going straight for the first one: I don't miss generics. Indeed, they are useful. I use them in Java every time I fin
by im_dario 12y ago
This article has some good points but I'm going straight for the first one: I don't miss generics.
Indeed, they are useful. I use them in Java every time I find a good reason to do it. So, I should say in another way: I don't miss generics in Go.
Given my experience [0] in Go in the last years, I realized that if you miss generics in Go, your code is trying to cope with too much.
I didn't miss them when I developed Mergo [1], a simple library to merge structs. I think we all agree if we should rewrite this in Java (or other language with similar type system) we would use generics at some point.
[0] https://github.com/imdario?tab=repositories https://github.com/imdario?tab=repositories
[1] https://github.com/imdario/mergo https://github.com/imdario/mergo
- friendly_chap 12y agoDid you miss it when you were working on larger codebases? The library you mentioned clocks at 500 LOC, and while the LOC metric is pretty inaccurate, it takes a lot more time to really miss language features.
- NateDad 12y agoI've been working on Juju for 18 months, which is over 250k LOC and have not missed generics at all.
- im_dario 12y agoNo. I didn't. I have around 2K public LOC in several projects (I can't check now my private projects, I guess I had typed more than that) but I would trust better NateDad's experience. I have two years of sustained Go usage (since end of 2012) and never missed them.
- deleted 12y ago[deleted]
- colin_jack 12y ago"I realized that if you miss generics in Go, your code is trying to cope with too much." Was wondering what you mean by that (not disagreeing just interested)?
- im_dario 12y agoI meant that if you miss generics, your code is probably too complex.
- colin_jack 12y agoSorry yeah I get that, but in what way?