4 ms·
Fully agree that generic type system is nicer than code generation; however, code generation thankfully isn't the only alternative nor even the best. Rather, as
by throwaway894345 6y ago
Fully agree that generic type system is nicer than code generation; however, code generation thankfully isn't the only alternative nor even the best. Rather, as previously mentioned, we can use `interface{}` which is roughly the same as using dynamic types for the relevant bit of code. If people can make blockbuster apps with dynamically typed languages (100% of code paths are dynamically typed), it's really not a big deal that Go makes you drop into dynamic typing for <5% of code paths.
- jacques_chester 6y agoI don't see interface{} as an improvement over code generation.
- throwaway894345 6y agoI think you'll find that your opinion is very fringe, but by all means, go forth and use code generation.
- jacques_chester 6y agoMy opinion is that I greatly prefer generics to either.
- loopz 6y agoHaving genetics as a good option is great. Using interface{} works too, but is a kludge if you have to do it alot. You lose performance to reflection and gain runtime errors that are hard to handle. It's not the best part of Go, far from it.