6 ms·
> The number of times I've needed a generic abs in my life -- zero. What about a generic max() or min() function?
by azth 13y ago
> The number of times I've needed a generic abs in my life -- zero.
What about a generic max() or min() function?
- cgh 13y agoOr a generic list, vector, map...
- personZ 13y agoGo's native synonyms of lists, vectors and maps are already "generic", so I'm not sure what your point is.
- cgh 13y agoExcept the containers aren't typed. They are essentially containers of void*. If you believe that to be "generic", then you don't understand the topic.
- personZ 13y agoThis is simply wrong, and you clearly don't understand Go (which, as we've amply seen, doesn't stop people from pontificating about it).
- cgh 13y agoYou are right, I overlooked the magic of Go's build-in containers (I admit, I haven't touched the language after we looked at it around a year ago). I amend my comments to apply to user-defined containers and types, where generic == interface{}...at least, it did when we tried the language out. This is an example of a simple "generic" in Go, as I recall it: type mytype struct { mydata interface{} } The casting this requires felt like a step into the past when you're used to eg the STL.