David Cantrell wrote:
chromatic wrote:
On Thursday 06 April 2006 17:53, Adam Kennedy wrote:
UNIVERSAL::isa/can when called as a function does a very specific thing,
and one that is often misunderstood.
... and never correct, in the face of proxy objects, blessed objects,
overloading, and ties.
I disagree. In particular, I disagree that
Data::Compare::Plugins::Data::Transactional, which uses isa as a
function on a tied and blessed thingy, is incorrect.
Of course, if you feel that it *is* incorrect, I'd welcome a failing test.
Oh really? :)
Here's your acid test, should work on anything that claims to be OO.
my $your_object = (as normal);
my $lookalike = Class::Adapter::Clear->new($your_object);
(your tests as normal)
In fact, if it breaks with Class::Adapter::Clear, which is specifically
designed to make NO change in behaviour in OO code (and thus be usable
as a base class), that also breaks with anything that follows the
Adapter pattern, like Object::Destroyer, or things generated using
Class::Adapter::Builder.
It should also break with the Mock Pattern things like chromatic's module.
Just because I (repeatedly) attack chromatic over UNIVERSAL::isa/can
nobody should be under the impression that using the functions directly
is in any way a good thing.
The only cases for which it's genuinely useful is asking "ignoring what
you say you are in OO terms, what are you actually implemented as
underneath".
Adam K