On Thu, Jul 13, 2023, at 3:09 PM, Robert Landers wrote: > I just want to say that between all of you, I get this feature now. > > Maybe someone should open an RFC where your vote doesn't count unless > you provide feedback on the list. (ban drive-by votes) > > We may not have the power to vote, but we can open RFCs.
Since a few people commented something to the effect of "if we're going to do this, we should go all the way to multiple inheritance for realsies," I decided to dig into that a little further. I surveyed 14 major languages: C,C++, Java, Kotlin, Swift, Rust, Go, C#, Haskell, TypeScript, PHP, Javascript, Python, and Ruby. Of them: C++ and Python support multiple inheritance via extends mechanisms. Java, Kotlin, Swift, Rust, and C# support interface default methods. Go is weird, because it doesn't have inheritance per se, but its type composition system is almost multiple inheritance if you squint. And because it has structural typing, you can provide a method that applies to type A, and if type B uses type A, the method will work on B, too. So... it kinda sorta does interface default methods if you squint, but it's kinda squishy where you draw the line. Haskell has type classes, not interfaces. Type classes are not the same thing as interfaces or inheritance, but effectively allow for functionality equivalent to interfaces with default implementations. The syntax is quite different, but the basic concept is there. Typescript has mixins, which are not quite multiple inheritance since they happen at runtime, as far as I can figure. So, maybe they count as multiple inheritance, ish? Javascript has nothing, because it barely has a type system. Ruby has "modules", which I think are roughly equivalent to traits. Based on that, I would conclude: * Multiple inheritance is not a fringe old feature that has been left to the dustbin. A majority of languages surveyed have multiple inheritance in some fashion! * Of those that do, a majority of them implement it via interface default methods, or their approximate language equivalent. So it seems, based on the data, that this RFC *is* multiple inheritance, done the industry standard way, and multiple inheritance done this way is pretty common to the point that by not having it, PHP is in the minority. So if you want "multiple inheritance done right", that's what this RFC is already. I hope that helps clarify the context. --Larry Garfield -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php