News for hackers. Stuff that matters.
Re:Go 1.5 Release Notes by aikah on Friday July 31, 2015 @04:09PM (#9984108)
AFAIK you can create a named type from interface{}

type V interface{}

Don't hold your breath when it comes to generics. There is no way they can retrofit them without breaking the language, it's too late. Even features like covariance or unions are just out of question.

An option would be to write a super-set of Go with generics that would compile to Go code. what it would do basically is use interface{} everywhere the variable type T is required and insert type assertions for the user. Been thinking about that.

Re:Go 1.5 Release Notes by snuxoll on Friday July 31, 2015 @06:11PM (#9984821)
> An option would be to write a super-set of Go with generics that would compile to Go code. what it would do basically is use interface{} everywhere the variable type T is required and insert type assertions for the user. Been thinking about that.

I think that's pretty much how you'd want to do it, it's type erasure just like generics in Java - sure, some people complain about not having reified generics, but I'm more concerned about type-safety, Go already has some runtime reflection capabilities anyway.

Re:Go 1.5 Release Notes by ninkendo on Friday July 31, 2015 @06:32PM (#9984903)
> An option would be to write a super-set of Go with generics that would compile to Go code.

You could call it go++!

(But seriously, that's pretty much what C++ did to C.)