News for hackers. Stuff that matters.
Re:Classes Considered Harmful [pdf] by codr4life on Tuesday January 03, 2017 @04:14PM (#13313168)
But virtual dispatch is trivial to add where you actually need it, a bunch of function pointers in a struct and you're good to go. And once you stop viewing the world through the OOP filter there aren't that many real hierarchies and interfaces left to deal with. The curse of OOP is that it turns problem solving into day dreaming, with expected results.
Re:Classes Considered Harmful [pdf] by recursive on Tuesday January 03, 2017 @08:54PM (#13315050)
OOP isn't the solution to every problem. Your proposed replacement to inheritance would would work nicely in some cases. As far as I can tell, it doesn't address the use case of generic classes at all, at least in a type-safe way.
Re:Classes Considered Harmful [pdf] by codr4life on Wednesday January 04, 2017 @02:37AM (#13316420)
Generics and OOP are orthogonal, one does not depend on the other. So let's say you declare your vtbl struct with a generic parameter, what's the difference?
Re:Classes Considered Harmful [pdf] by recursive on Wednesday January 04, 2017 @12:34PM (#13320228)
Hm. I think you're right. It's probably my classical OOP conditioning causing me to conflate them.
Re:Classes Considered Harmful [pdf] by euyyn on Wednesday January 04, 2017 @04:23AM (#13316832)
> But virtual dispatch is trivial to add where you actually need it, a bunch of function pointers in a struct and you're good to go.

Or let the compiler do it for you? It's like saying I shouldn't use first-class closures, because they're also trivial to implement manually where I actually need them.