4 ms·
The craziness is preferable to passing void* or Object or Interface{} everywhere. At that point, you might as well use a language without strong typing, for all
by twblalock 9y ago
The craziness is preferable to passing void* or Object or Interface{} everywhere. At that point, you might as well use a language without strong typing, for all the safety you're going to get. You can end up with just as much craziness with void* and Object and Interface{}.
The Go team needs to stop trying to control what people do with their language. If people come up with crazy implementations, it's their own problem. It's up to the Go community to provide alternatives to prevent those crazy implementations from becoming standardized in Go programming culture. Refusing to implement generics because programmers might abuse them is paternalistic and counterproductive.
- tomovo 9y ago"If people come up with crazy implementations, it's their own problem." Some people are turned away from C++ after seeing random bits of crazy language/template misuse, although when used sanely C++ could've served them nicely for their job. Same thing is going to happen to Swift very soon. https://engineering.kitchenstories.io/comfortable-api-requests-from-the-kitchen-stories-ios-app-561ba54e8c0a https://engineering.kitchenstories.io/comfortable-api-reques... Those function signatures are definitely not... self-documenting, I'd say.
- dbaupp 9y agoThose signatures seem complicated to me because there's a pile of arguments and some of them are functions with extra annotations, not because there's generics involved. The equivalent signatures using interface{} (or maybe something more precise) would be likely just as noisy, if not more so.
- tumdum_ 9y agoUsing interface{} you never get implicit/silent conversion, so Go type system is strong (and static obviously). It just lack parametric polymorphism.