rehsack has asked for the wisdom of the Perl Monks concerning the following question:
I'm seeking perl wisdom against my "OO wisdom" ;-)
But maybe my OO wisdom needs to be updated, too.
I've written an XS speedup for Params::Util - and the author detects that my XS implementation of _INSTANCE differs to his perl implementation: The perl implementation simply calls $obj->isa($class) - and returns the result. The XS implementation checks first sv_derived_from and only in a negative result, it calls $obj->isa($class) (I think, I should even prove string equality of sv_reftype - but this is another story). My reason to implement it this way was:
B is a Aclass A { ... }; class B : public A { ... };
So what do you think? Should the XS implementation give the (overridable) isa method the precedence? Or is it just a limitation? Should the perl implementation better use UNIVERSAL::isa before trying the overridden method?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: sv_derived_from vs. sub ISA
by chromatic (Archbishop) on Apr 04, 2009 at 17:25 UTC | |
by rehsack (Sexton) on Apr 06, 2009 at 06:42 UTC | |
by chromatic (Archbishop) on Apr 06, 2009 at 07:41 UTC |