in reply to Re: Do you consider these different or the same?
in thread Do you consider these different or the same?
I might reuse the same date object multiple times in the expected values even though the result values have multiple different occurrences of the same date value. I don't want that to be a problem.
Then you dont want a deep comparison, you want a shallow comparison. In fact you want the proposed 'looks_like()' method.
Finally in relation to is_deeply, it considers
to be a pass.
Actually it doesn't. At least not in version 0.60
I and others know exactly what it's doing. Sometimes I use it, mostly I don't but changing its behaviour at this stage risks breaking tests and
My position is that we can eliminate the confusion by making is_deeply() do a proper deep structural comparison and provide a different routine (that would conveniently share its implementation with is_deeply).
Long term I believe this would clear up a LOT of misunderstanding about references that I see even experienced Perl programmers making. Misunderstanding such as is_deeply() considering $ar1 and $ar2 to be the same, which is just totally wrong.
my ($x,$y,$ar1); $x=\$y; $y=\$x; $ar1=[$x,$y]; my $ar2; $ar2->[0]=\$ar2->[1]; $ar2->[1]=\$ar2->[0]; is_deeply($ar1,$ar2); #this is wrong, wrong, wrong.
If is_deeply()'s behaviour doesn't change then it should have very large warnings on it that it doesnt do what it claims to do (that is checking if the objects are deep copies of each other.)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Do you consider these different or the same?
by fergal (Chaplain) on Jul 01, 2005 at 14:01 UTC | |
|
Re^3: Do you consider these different or the same?
by hv (Prior) on Jul 01, 2005 at 14:39 UTC | |
by demerphq (Chancellor) on Jul 01, 2005 at 15:28 UTC |