On Sun, Jul 03, 2005 at 01:13:50AM +0100, Fergal Daly wrote:
> On 7/3/05, Andrew Pimlott <[EMAIL PROTECTED]> wrote:
> > Can you give me a hint as to the difference in a language like Perl?
>
> When they are the same reference they are the same reference (can't
> think of any other way of saying it). When they are bisimulable,
> they're not the same reference but there is nothing you can do to tell
> them apart (except actually looking at refaddrs). Obviously if you
> change 1 of them you can tell them apart but if you make the same
> change to the other they become indistinguishable.
How about
my $a = [];
my $b = [];
my $s = sub { $_[0] == $a; }
is_deeply($a, $b); # passes
is_deeply($s->($a), $s->($b)); # fails
> http://en.wikipedia.org/wiki/Bisimulation
>
> has some unhelpful definitions.
:-)
> > I was thinking that the comparison function would be a class method that
> > would be called after verifying that two references point to objects in
> > the same class. I think that should be safe enough.
>
> The bug might depend on the data so although the code might be
> identical on both sides, the code-path might be different.
If you're saying the comparison function might be buggy, ok sure.
However, there are cases where objects in a class can have variant
representations and still be observationally the same (assuming the user
respects some abstraction boundary). In this case, a comparison
function for that class is appropriate.
> If you
> realy want deep testing with custom tests that can apply deep inside
> Test::Deep, already does it,
But your custom tests might be buggy. :-)
Andrew