Comment Re: Rust is a specialist language (Score 1) 184
Sort of. By definition, OOP requires inheritance.
Inheritance is but one aspect of OOP, and is not the only one. OOP is a number of techniques, none of them obligatory, but most importantly I see it as a design tool. I've done OOP without inheritance hierarchies. Don't get me wrong, I absolutely hate the 90s and the books on software design that created bloatware for decades, but OOP is not as harmful as agitators today insist it is. Done right, it can be as efficient as high-performance code”, because it will translate to the same code. Done wrong (which is how everything will be done, anyway), it will result in bloatware. I understand why people hate it, but not using OOP does not mean an automatic improvement of the code quality or performance.
The Linux kernel doesn't use any analog to inheritance, and neither does rust.
Last I checked, there are structures with pointers to functions, and that's a one-level inheritance (which is what most of the sane OO design uses). You basically have an interface and leaves, and that's absolutely fine OO design.
This is the one and only reason why rust is not considered to be an OOP language.
That subtracts from its value, does not add.
And honestly, inheritance is an ill-conceived idea to begin with. Inevitably you end up with the fragile base class problem and decide, after it's way too late, that you should have just stuck with composition. And when you really think about it, what real-world problem is solved by modeling it based on inheritance? Other than maybe simple shapes, nothing much, and even with shapes it can run into problems.
I hate to disappoint, and I will not go into detail for this rant, however, there are real issues solved by inheritance. As I said, most are one level deep - interface + implementation. I worked on enough solutions that showed me that even multiple inheritance and multiple levels of inheritance make sense. I work in the embedded space mostly, and in RT software, and I can tell you that there's a cost and a benefit, and most of the time, the benefits of the inheritance-based design outweighs the cost of it. However, I am not here for a lecture in software architecture. You'll have to take my trust me, bro” or pester me in private.
People used to think OOP was perfect for games, but it turns out it's pretty crap.
I'll not comment on the rest of the paragraph, but I believe there's a lot of OO design in games to say that it's... fine? OOP is not a single feature. It is an application of a design that is expressed as objects, and C++ for example allows you to actually bypass the virtual calls completely (templates, CRTP) if you want performance from your OOP. I do get why Muratori is upset with some OO-way to do things, but he is also exaggerating, and terribly biased.
Multi-inheritance is even uglier. You know why Bjarne Stroustrup added that to C++? Basically because somebody else said that it can't be done in C++, and he wanted to prove them wrong. That's always a great reason to add a feature to a language, wouldn't you say?
Citation needed. But also, I've seen multiple inheritance used correctly and it has been a useful feature. I would definitely return your PR if you sent me a multiple-inheritance solution where you'd have critical speed requirements, but I have seen it used correctly, and I don't care if Bjarne added it just to show off, it's good thing that it did happen.
What's wrong with RAII?
Nothing, he's just one of those idiots who likes to shout a bunch of buzzwords as if he understands what they mean even though he has no idea.
I still would've loved to hear the original reply, because he was quite sure that RAII is a bad thing, and I would've loved to hear the arguments.