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.


In reply to dynamic inheritance by steves

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.