3 ms·
But isn't that sort of the point? Traits aren't multiple inheritance.
by TylerE 10y ago
But isn't that sort of the point? Traits aren't multiple inheritance.
- seanmcdirmid 10y agoThere are multiple meanings of traits flying around in different languages. Some traits are type classes (Rust), some traits are mixins (Scala). The former are not really related to class-based inheritance, while the latter most definitely is (linearized multiple inheritance as defined by Cook & Bracha, not the mixins of CommonLisp). Self and smalltalk style traits are even more different.
- qznc 10y agoDon't forget C++ traits, which are more like a design pattern.
- pjmlp 10y agoCS papers about it might disagree.
- riffraff 10y agoO think there is a problem with multiple inheritance being somewhat ill-defined. I recall reading OOSC[0], where Meyer showed that MI in Eiffel is fine, and it basically boiled down to: when there is an ambiguity, force the child class to rename the conflicting methods/redefine them, which is very close to what the original traits paper[1] suggests (bar state in traits, IIRC). [0] https://en.wikipedia.org/wiki/Object-Oriented_Software_Construction https://en.wikipedia.org/wiki/Object-Oriented_Software_Const... [1] http://www.ptidej.net/courses/ift6251/fall06/presentations/061122/061122.doc.pdf http://www.ptidej.net/courses/ift6251/fall06/presentations/0...