in reply to Re: sv_derived_from vs. sub ISA
in thread sv_derived_from vs. sub ISA

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.)

So if I understand you correctly, it's recommented to do:
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(@_); }
against:
package A; sub foo {}; package B; sub bar {}; package C; use vars qw(@ISA); @ISA = qw(A B);
Or at least it's an allowed and wanted to work way? Further: It's allowed and wanted to work that:
package C; use vars qw(@ISA); @ISA = qw(B); sub foo {}; sub isa { return $_[1] eq 'A'; }
To prevent, C is no B?

Replies are listed 'Best First'.
Re^3: sv_derived_from vs. sub ISA
by chromatic (Archbishop) on Apr 06, 2009 at 07:41 UTC

    Yes, that's allowable. It's probably not a good idea from the OO design standpoint, but it's allowable.

    (In your first case, I'd override UNIVERSAL::DOES instead, but that's a 5.10 feature.)