steves has asked for the wisdom of the Perl Monks concerning the following question:
I started playing with dynamic inheritance and am looking for feedback from anyone else insane enough to do this.
My first attempt mostly works. The idea behind this is really to do instance inheritance. The basic problem being this: I have a generic interface that implements 90% of a class interface. But a run-time set type in each instance determines the other 10% of the interface. To complicate matters, each instance could be derived from either the 90% parent class or one of its decendants.
The way I first tried this was to use AUTOLOAD. In there, I examine the type, change the 90% class @ISA array to include the appropriate 10% type package, then call the method I pick up doing that. But once I muck with @ISA, UNIVERSAL::can doesn't see it. I looked at the Perl source (version 5.6.1) and I see @ISA caching in there but it's unclear if that's at fault.
Any feedback on the caching or better ways to do this, or even people telling me I'm insane for doing this appreciated. I really need to play more but I figured it can't hurt to ask some monks now if it saves me work.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: dynamic inheritance
by chromatic (Archbishop) on Jan 31, 2002 at 01:57 UTC | |
by frag (Hermit) on Jan 31, 2002 at 16:31 UTC | |
by steves (Curate) on Jan 31, 2002 at 18:41 UTC |