|P is for Practical|
Re: Neverby hardburn (Abbot)
|on May 13, 2003 at 14:12 UTC||Need Help??|
Inheirtence with objects. I think tye has said something on this before.
Inheirtence is an incrediably powerful concept (even if it often isn't used right), and a primary reason to have an object system in the first place. However, Perl sucks at it.
First, run-time lookup of methods tends to slow inheirted objects down. Second, there are all sorts of hoops you must jump through to make sure both the parent and child classes can support inheirtence correctly (parent must have a well-behaved constructor, and child must have a well-behaved destructor (if you have one), for example).
I've gone over the problems with abstract classes/interfaces before.
Lastly, there needs to be data which both parent and child need to agree to use, but should not be visiable to the rest of the world. Java handles this with protected member data, but there is no similar standard in Perl OO (some might say this follows Perl's philosophy, but it also tends to add extra work for those needing to implement a subclass).
Note: All code is untested, unless otherwise stated