On Sun, Jun 26, 2005 at 12:06:47PM +0200, David Landgren wrote:
> > What it *shouldn't* do is what Test.pm does, namely execute the
> > code ref and compare the values returned.  It would just compare
> > the refernces.
> 
> Why should it not do that? Is this because of subs with side effects? 
> Isn't that more an issue of "Doctor, it hurts when I hit my knee with a 
> hammer"?

Its because it has no use from a testing PoV.

If you're comparing two data structures do you really want the code refs
to be executed?  Yes, they could have side effects.  What arguments do you
pass in?  What if its a method, where's the object?  But more to the point... 
if the return values match what does that tell you?  That for a single set
of inputs those two subroutines return the same thing.  I'll bet there's
a lot of functions out there that return the same thing when given no
arguments: undef.  Doesn't even tell you they *do* the same thing because 
of side-effects.  Not a useful means of telling if two arbitrary data
structures are equivalent.

I'd thrown that out there because its how the only precedent for code ref
testing we have, Test.pm, behaves and it is not to be followed.


-- 
Michael G Schwern     [EMAIL PROTECTED]     http://www.pobox.com/~schwern
Reality is that which, when you stop believing in it, doesn't go away.
        -- Phillip K. Dick

Reply via email to