3 ms·
O-O enough, usually. O-O does not add much power, by itself. If it had destructors, there would be something to build on.
by moloch-hai 4y ago
O-O enough, usually. O-O does not add much power, by itself.
If it had destructors, there would be something to build on.
- Rochus 4y agoYou're joking.
- vladsanchez 4y agoYep, he's a Joker, Delphi/Pascal hater.
- AnimalMuppet 4y agoMaybe not. Destructors are critical to writing (C++-style) OO. If you're taking and releasing resources of any kind (memory, files, semaphores...) then it's destructors or manual management. (Or garbage collection, which solves the 90% of the issue that is memory, and does nothing whatsoever to help with the remaining 10%.) Destructors are a huge game-changer. I don't think GP was joking at all.
- Rochus 4y agoFine, but this is unrelated to the actual argument. Btw. Object Pascal has descructors as well, and destructors by themselves have nothing to do with object-orientation; they can be implemented also in a non-OO language. But C - in contrast to Object Pascal - is definitely not an OO language (not in this nor any other universe); since every child knows this, it must be a joke.
- AnimalMuppet 4y agoAs I read it, the argument was that C was object-oriented "enough" to qualify as OO. (I've done object-oriented C, with function pointers in structs. It works just like virtual functions.) But C has no destructors, and destructors are the difference between "mere" OO and "something you can build on". As I said, that's how I read it. But it could be that your reading was correct...
- Rochus 4y agoYou can do OO programming in assembler, but that doesn't make assembler an OO language; the same applies to C. Therefore C cannot be "O-O enough" by definition, and nobody who knows an OO language can seriously state that "O-O does not add much power".
- moloch-hai 4y agoAM has got it right. Inheritance is just not often useful, unless you have nothing else to organize with. Sometimes it is just the right thing, but not often enough to need to be built into the language. If your language is expressive, you can make an inheritance library and use it to make your base and derived types on those occasions when they actually are useful.