News for hackers. Stuff that matters.
Re:Go 2 Draft Designs by orblivion on Tuesday August 28, 2018 @01:28PM (#17860791)
I'd say generics aren't just about avoiding copy-pasting. It's also added type safety. At this point the closest thing is using an interface as a function parameter. You get a dynamically typed value (albeit limited to types that implement the interface).
Re:Go 2 Draft Designs by sacado2 on Tuesday August 28, 2018 @03:42PM (#17862190)
That, and efficiency, as the generated code can be inlined in many cases.
Re:Go 2 Draft Designs by lima on Tuesday August 28, 2018 @02:26PM (#17861417)
The closest thing is auto-generating code, not using interface{}.
Re:Go 2 Draft Designs by platinumrad on Tuesday August 28, 2018 @02:34PM (#17861527)
Yes, but there's still a depressingly large amount of code in the wild that just casts interface{} back and forth.
Re:Go 2 Draft Designs by lima on Tuesday August 28, 2018 @02:40PM (#17861585)
Common with ORMs. The gorm API is horrible - it's all interfaces.

The only reasonable ORM library I've seen is sqlboiler, which uses code generation.

https://github.com/volatiletech/sqlboiler

Re:Go 2 Draft Designs by orblivion on Tuesday August 28, 2018 @05:57PM (#17863291)
I don't necessarily mean interface{}. This:

type Thing interface { ... }

is better, but Thing is still a dynamic type.