in reply to Re: How to do multiple inheritance?
in thread How to do multiple inheritance?
Not sure how it would be "implemented" internally, but my "SuperDeluxe" preference would be to explain to perl that "$s" (handle to left parent) should be used for left-parent accesses, and "$w" (handle to right parent) should be used for right-parent accesses.
Something on the order of:
"Seems" like any class other than the 1st parent is a bit like a "second class citizen": can't specify in "use base(...)", and inheritance is only handled automatically for the left-most ISA member. Any other use of multiple inheritance, and it seems like it's mostly "do it yourself". Can't even have "structs" that are nested because of a disallowing of any "inherited" structs (as in "use struct...") -- was going to use that module (actually was using), until I got to next 'struct' further up....then I realized what I wanted to do wasn't supported...*sigh*.@ISA=qw(Sclass, Wclass); .... new(){ my $s=Sclass->new(); TELL_ISA_LOOKUP_USING(Sclass, 'self') #(self=this class's handle) # and use the "wclass_handle_field as handle for Wclass: TELL_ISA_LOOKUP_USING(Wclass, 'self'->{'wclass_handle_field'}) .... }
Thanks much -- I was just hoping I didn't understand something, since it seems like manual disambiguation and making sure correct handles are used with correct ancestor really is _not_ "multiple inheritance" -- since how can "MI" ever work "automatically", if non-primary base classes are always passed the handle to the primary base class? :-(
|
|---|