On 7/2/05, Michael Peters <[EMAIL PROTECTED]> wrote: > But if we say > x=y and x=z can we then say that x,x != y,z > > If say > $x = []; > $y = []; > $z = []; > is_deeply($x, $y); # passes > is_deeply($x, $z): # passes > is_deeply([$x,$x], [$y, $z]); # fails for some reason > > If we broke this out into a formal logical proof, the only way > that x,x != y,z would would is if x != y or x != z, or both.
The reason this happens is because the calls to is_deeply are entirely independent. If is_deeply behaved as Yves wanted _and_ the results of multiple calls were consistent then actually the second call would fail because we've already matched $x with $y so we can't match it up with $z too. It really comes down to 2 questions 1 Is there a difference between "an array containing references to 2 empty arrays" and "an array containing 2 references to the same empty array". Quite clearly the answer is yes if you don't believe it, see the party example below. 2 Given that they are different, is it ever a significant difference? For example could it cause a bug if one of them was replaced by the other? Again clearly the answer is yes. Yet another analogy - you have a 2 black boxes each with 2 pipes in at the top and 2 taps at the bottom. You pour wine into the left pipe on both and lable the left tap "wine". You pour beer into the right pipe on both and label the right tap "beer". Your friends arrive for the party and start pouring themelves drinks. Some of them get wine, some get beer but some get a horrible mixture of wine and beer from both of its taps. One of the black boxes was my $x=[]; my $y=[]; [$x,$y]; the other was my $x=[]; [$x,$x]; F