4 ms·
This is an interesting discussion -- interesting in part because it addresses a mindset that I don't seem to have. C++, for example, has multiple inheritance,
by ggchappell 15y ago
This is an interesting discussion -- interesting in part because it addresses a mindset that I don't seem to have.
C++, for example, has multiple inheritance, and I have used it to good effect. OTOH, if I needed to implement Dijkstra's Alg in C++, then I don't think it would even occur to me to inherit from both a priority queue and a directed graph base class. (And even now that it does occur to me, it doesn't seem to be a good idea.) Rather, I'd use something akin to the interfaces presented here. Of course, interfaces are not formalized in C++, but the C++ culture does include the notion of a concept, to be used with a template.
If the language were Python, I'd proceed similarly. And then there's Java, which doesn't even have multiple inheritance. I've never heard anyone claim that Java is somehow ill-suited for the implementation of graph algorithms (but maybe it is -- never thought about it).
Perhaps what this discussion is overturning, is not so much a multiple-inheritance mindset, as an Eiffel mindset. (But I don't know much Eiffel, so it's hard to say.) And the discussion also suggests that Go's formalization of interfaces can be a Good Thing.
- _delirium 15y agoI also don't know much Eiffel, but I believe this 1988 article is the canonical pro-multiple-inheritance-in-Eiffel piece (by Eiffel's creator): http://archive.eiffel.com/doc/manuals/technology/bmarticles/joop/multiple.html http://archive.eiffel.com/doc/manuals/technology/bmarticles/...
- sorbits 15y agoI think there are many who doesn’t split types and algorithms, and something like Java does/did make it cumbersome plus its standard library doesn’t do it — but the C++ comity adopted STL into the standard library 13 years ago, which is all about separating algorithms from their types, and was actually born out of Alexander Stepanov’s work with graph algoritms, so I was also a little surprised by his generalizations and specifically calling out C++ (twice).