in reply to Re: sv_derived_from vs. sub ISA
in thread sv_derived_from vs. sub ISA
So if I understand you correctly, it's recommented to do:Should the XS implementation give the (overridable) isa method the precedence?Only if you want Perl's OO to keep working. In all other cases -- every one -- Perl calls overridden methods which optionally call super methods.
(Modern versions of UNIVERSAL explicitly recommend against calling UNIVERSAL::isa directly.)
against:package A; sub foo {}; package B; sub bar {}; package C; use vars qw(@ISA); @ISA = qw(B); sub foo {}; sub isa { return $_[1] eq 'A' or $_[0]->SUPER::isa(@_); }
Or at least it's an allowed and wanted to work way? Further: It's allowed and wanted to work that:package A; sub foo {}; package B; sub bar {}; package C; use vars qw(@ISA); @ISA = qw(A B);
To prevent, C is no B?package C; use vars qw(@ISA); @ISA = qw(B); sub foo {}; sub isa { return $_[1] eq 'A'; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: sv_derived_from vs. sub ISA
by chromatic (Archbishop) on Apr 06, 2009 at 07:41 UTC |