Hacker News new | past | comments | ask | show | jobs | submit login

Or a generic list, vector, map...



Go's native synonyms of lists, vectors and maps are already "generic", so I'm not sure what your point is.


Except 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.


This is simply wrong, and you clearly don't understand Go (which, as we've amply seen, doesn't stop people from pontificating about it).


You 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.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: