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

Inheritance as implemented by Go provides for a different school of thought from C++. In C++, you define the taxonomy, then define the objects in relation to that taxonomy. In Go its the opposite, defining taxonomy in relation to the objects.

In concrete terms for C++, this means that abstract base classes Must be defined before the objects are defined. So if I wanted to use a library, I would be entirely restricted to whatever abstract base classes they define.

For Go, I could use a library and then define whatever interfaces I needed specifically for the functions I want to implement. Its effectively a much more structured and rigorous architecture for templated code.

At least this is my understanding. I've explored Go just enough to get some of the higher level concepts but I haven't quite dug into it yet. So correct me if I'm wrong.




You should take a look at the Concepts TS - if I understand what you're trying to achieve correctly then Concepts are the approach C++ is taking to address these types of issues.




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

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

Search: