in reply to Re^2: subroutine concatenation
in thread subroutine concatenation

If you overrode _cat_sub in CatCode::Reverse, you could replace the conditional with polymorphism and wouldn't have to use the polymorphism-hostile direct UNIVERSAL::isa call.

Replies are listed 'Best First'.
Re^4: subroutine concatenation
by Fletch (Bishop) on Feb 10, 2005 at 01:32 UTC

    True, but then it wouldn't be able to break encapsulation and pull out $other->{_code} to speed things up by avoiding another overloaded &{} dispatch. Then again that's not exactly safe either, but what does one expect for a ten minute one-off example. :)

    A better solution might be to ask if UNIVERSAL::can( $other, "to_code" ) and then use that to obtain a coderef from $other (which would be starting to look a bit like duck typing . . .).