Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

In Go returning a list of items that are one of a set of different types would be poorly handled. It's possible but very awkward. You would probably drop down to just a slice of interface{} and then have to use reflection to figure out what each item was.

Dynamic languages like Python or Ruby would probably be fine but there are more languages than those out there to worry about.



There are ways of modeling sum types in Go (a struct with a few fields and a tag, an interface that's only implemented by the relevant types, etc), but that's unrelated to the database/client interface.




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

Search: