On 7/2/05, Michael Peters <[EMAIL PROTECTED]> wrote:
> That's what I'm trying to point out. If we follow the reasoning fully
> out then the second call to is_deeply() would need to fail as well as
> the first. Try explaining that to the someone using it.
> 
> calls to is_deeply() *need* to behave independently. It should only fail
> if the things being compared are structurally equivalent. To have it
> 'maintain state' between calls (even if that state is maintained through
> inside of other structures) would just be asking for weird things to happen.

Nobody is suggesting it should maintain state between calls. I was
just commenting on your  proof.

You took the result of 2 calls to is_deeply and used it to deduce the
result of a 3rd call but this is not a valid deduction because the
calls are totally independent. If you want to be able to use earlier
results to deduce later ones then you _would_ have to maintain state.

Again nobody is advocating it but let's say it does maintain state.
Then the contradiction goes away because we'll have

is_deeply($x, $y); # passes
is_deeply($x, $z); # fails because $x is now paired with $y
is_deeply([$x,$x], [$y, $z]); # fails $x != $z

> If we try to have is_deeply() modify the arguments it recieves to see if
> they behave the same then we run into all kinds of issues with tied
> structures or objects that are mere interfaces with other, more
> permanent storage.

Nobody suggested modifying things during the test either, it wouldn't
help anything.

The point about modification is that if 2 things start out equal to
one another and they are modified in the same way then they should
still be equal to one-another.

is_deeply doesn't test for this kind of equality but you might think
it does from the name and from the docs. It would be relatively easy
to make it test for this kind of equality but that won't happen.

I can understand you saying that Yves' notion of equality is not what
you consider useful at the moment but you appear to be saying that
it's not a valid or useful notion of equality at all,

F

Reply via email to