Comment Re:What could possibly go wrong? (Score 2) 189
> Good grief. Java and C# both allow for multiple interfaces, which is very closely related. That's the majority of use for multiple inheritance in C++. It's more or less nonsense to talk about that in JS anyway since it's fully dynamic and duck typed. You can completely smoosh two objects together. You can fuck with the prototype chain (even at runtime).
The other option here is to use nested, or even anonymous, classes, at least in Java. It can be ugly but objects of the class can have methods that return different representations of themselves that can all access the same underlying object's private variables and methods. In Java this is done quite elegantly (that's not a phrase you hear very often), Alas AFACS it's not implemented directly in Rust, so you'd need a lot of glue code to achieve the same thing.
Are nested classes better? *shrug* I guess it's more explicit and there's less risk of a name clash if the objects you're inheriting have similarly named methods/properties that do not work the same way? And from that point of view it could be argued it's a superior option to regular multiple inheritance, if the language supports it as well as Java does.
I'm half way in agreement with OP about MI. I don't think it's an anti-pattern so much as something easily abused and hard to do well. So I rather like Java's approach here. There's probably some edge cases where C++ will allow something that Java wouldn't, but I don't know enough about C++ to comment. Can you specify the type of a parameter to require two different classes? It's about the only thing I can think of.