News for hackers. Stuff that matters.
Re:The Next Step for Generics by saghm on Tuesday June 16, 2020 @04:05PM (#23543415)
I'm usually a bit of a skeptic when it comes to Go, but this proposal surprised me; for the most part, or seems like this is exactly what I would want if I were a Go programmer. Being able to define both unbounded generic parameters and parameters bounded by interfaces is key, and while from skimming I'm not sure if it allows giving multiple interfaces as a bound, in practice this shouldn't be a huge issue due to how Go's interfaces are implicitly implemented (which would allow you to define a new interface that's the union of all the other interfaces you want to require, and all the types that implement all of them will automatically implement the new one). Interestingly, the proposal also defines what is essentially a union type interface, which I think is something that Go definitely could use. Although there are a couple of minor warts (e.g. not being able to have generic methods) and the syntax is not what I'd personally pick, overall I'm pretty impressed.
Re:The Next Step for Generics by djur on Wednesday June 17, 2020 @01:39AM (#23548182)
As someone who doesn't enjoy Go but is increasingly having to deal with it at work, I'm very happy with it.