Re: Fwd: [EMAIL PROTECTED]: Re: fixing is_deeply]

2005-07-05 Thread Fergal Daly
On 7/4/05, Andrew Pimlott [EMAIL PROTECTED] wrote: On Mon, Jul 04, 2005 at 12:36:29AM +0200, demerphq wrote: On 7/3/05, Andrew Pimlott [EMAIL PROTECTED] wrote: Would using my $s = sub { $a-[0] = 1; $_[0]; } above also be looking at refaddrs? No. But it wouldnt be symmetric

Re: Fwd: [EMAIL PROTECTED]: Re: fixing is_deeply]

2005-07-05 Thread demerphq
(apologies about the slow follow up) On 7/4/05, Andrew Pimlott [EMAIL PROTECTED] wrote: On Mon, Jul 04, 2005 at 12:36:29AM +0200, demerphq wrote: On 7/3/05, Andrew Pimlott [EMAIL PROTECTED] wrote: Would using my $s = sub { $a-[0] = 1; $_[0]; } above also be looking at

Re: Fwd: [EMAIL PROTECTED]: Re: fixing is_deeply]

2005-07-05 Thread Fergal Daly
On 7/5/05, Andrew Pimlott [EMAIL PROTECTED] wrote: On Tue, Jul 05, 2005 at 01:24:38AM +0100, Fergal Daly wrote: There's an easy way to see what's accptable and what's not and what exactly this level equality means. Consider the following code template: ### # lots of stuff doing

Re: Fwd: [EMAIL PROTECTED]: Re: fixing is_deeply]

2005-07-05 Thread Andrew Pimlott
On Tue, Jul 05, 2005 at 10:15:16AM +0200, demerphq wrote: (apologies about the slow follow up) not slow in my book :-) On 7/4/05, Andrew Pimlott [EMAIL PROTECTED] wrote: On Mon, Jul 04, 2005 at 12:36:29AM +0200, demerphq wrote: On 7/3/05, Andrew Pimlott [EMAIL PROTECTED] wrote: Would

Re: Fwd: [EMAIL PROTECTED]: Re: fixing is_deeply]

2005-07-05 Thread Andrew Pimlott
On Wed, Jul 06, 2005 at 12:10:43AM +0100, Fergal Daly wrote: On 7/5/05, Andrew Pimlott [EMAIL PROTECTED] wrote: my $x = []; sub one_way = { $x } sub another_way = { [] } sub test = { $_[0] == $x } I don't think this breaks your rules, but see below. You're right, I messed that up

Re: Fwd: [EMAIL PROTECTED]: Re: fixing is_deeply]

2005-07-04 Thread Andrew Pimlott
On Tue, Jul 05, 2005 at 01:24:38AM +0100, Fergal Daly wrote: There's an easy way to see what's accptable and what's not and what exactly this level equality means. Consider the following code template: ### # lots of stuff doing anything you like including # setting global variables

Re: Fwd: [EMAIL PROTECTED]: Re: fixing is_deeply]

2005-07-03 Thread demerphq
On 7/2/05, Michael G Schwern [EMAIL PROTECTED] wrote: On Sat, Jul 02, 2005 at 09:18:30AM -0700, Ovid wrote: In short, I think most agree that we're talking about two separate things and that neither is wrong, so if someone wants to pitch a solution rather than continue a long email chain,

Re: Fwd: [EMAIL PROTECTED]: Re: fixing is_deeply]

2005-07-03 Thread Yitzchak Scott-Thoennes
On Sat, Jul 02, 2005 at 12:24:12AM -0700, chromatic wrote: On Sat, 2005-07-02 at 08:55 +0200, demerphq wrote: The entire basis of computer science is based around the idea that if you do the same operation to two items that are the same the end result is the same. Without this there is no

Re: Fwd: [EMAIL PROTECTED]: Re: fixing is_deeply]

2005-07-03 Thread Eirik Berg Hanssen
Fergal Daly [EMAIL PROTECTED] writes: 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. That implies that two array refs are not equal: use Test::More 'no_plan'; $x = [];

Re: Fwd: [EMAIL PROTECTED]: Re: fixing is_deeply]

2005-07-03 Thread Fergal Daly
See my reply to Andrew for the $a. stuff and see my reply a long time ago when I also said that is_deeply should stay the same (both for this case and others). I'm just defending the idea that such a comparison is self-consistent, possible and useful, F On 7/2/05, Eirik Berg Hanssen [EMAIL

Re: Fwd: [EMAIL PROTECTED]: Re: fixing is_deeply]

2005-07-03 Thread Fergal Daly
On 7/3/05, Andrew Pimlott [EMAIL PROTECTED] wrote: On Sat, Jul 02, 2005 at 07:34:47PM +0100, Fergal Daly wrote: On 7/2/05, Andrew Pimlott [EMAIL PROTECTED] wrote: Citing computer science as the basis of your position is just too much. The computer science answer to the comparison of

Re: Fwd: [EMAIL PROTECTED]: Re: fixing is_deeply]

2005-07-03 Thread demerphq
On 7/2/05, Eirik Berg Hanssen [EMAIL PROTECTED] wrote: Fergal Daly [EMAIL PROTECTED] writes: is_deeply($x, $y); # Equal, but should not be: $x .= ; # after the same modification $y .= ; # of the two things, they are is_deeply($x, $y); # not equal! But its not the same

Re: Fwd: [EMAIL PROTECTED]: Re: fixing is_deeply]

2005-07-03 Thread demerphq
On 7/3/05, Fergal Daly [EMAIL PROTECTED] wrote: I (and I think Yves) had always been thinking in terms of 2 structures that had been produced independently, that is nothing in $a can be part of $b but that's not realistic. In real test scripts, chunks of the expected and the received values

Re: Fwd: [EMAIL PROTECTED]: Re: fixing is_deeply]

2005-07-03 Thread demerphq
On 7/2/05, Andrew Pimlott [EMAIL PROTECTED] wrote: On Sat, Jul 02, 2005 at 08:55:34AM +0200, demerphq wrote: The entire basis of computer science is based around the idea that if you do the same operation to two items that are the same the end result is the same. Citing computer science

Re: Fwd: [EMAIL PROTECTED]: Re: fixing is_deeply]

2005-07-03 Thread Andrew Pimlott
On Sun, Jul 03, 2005 at 12:32:01PM +0100, Fergal Daly wrote: On 7/3/05, Andrew Pimlott [EMAIL PROTECTED] wrote: How about my $a = []; my $b = []; my $s = sub { $_[0] == $a; } is_deeply($a, $b); # passes is_deeply($s-($a), $s-($b)); # fails Near

Re: Fwd: [EMAIL PROTECTED]: Re: fixing is_deeply]

2005-07-03 Thread Andrew Pimlott
On Sun, Jul 03, 2005 at 01:53:45PM +0200, demerphq wrote: On 7/2/05, Andrew Pimlott [EMAIL PROTECTED] wrote: On Sat, Jul 02, 2005 at 08:55:34AM +0200, demerphq wrote: The entire basis of computer science is based around the idea that if you do the same operation to two items that are the

Re: Fwd: [EMAIL PROTECTED]: Re: fixing is_deeply]

2005-07-03 Thread Andrew Pimlott
On Mon, Jul 04, 2005 at 12:36:29AM +0200, demerphq wrote: On 7/3/05, Andrew Pimlott [EMAIL PROTECTED] wrote: Would using my $s = sub { $a-[0] = 1; $_[0]; } above also be looking at refaddrs? No. But it wouldnt be symmetric would it? It's no less symmetric that the first

Re: Fwd: [EMAIL PROTECTED]: Re: fixing is_deeply]

2005-07-02 Thread Michael G Schwern
On Sat, Jul 02, 2005 at 08:55:34AM +0200, demerphq wrote: quote Similar to is(), except that if $this and $that are hash or array references, it does a deep comparison walking each data structure to see if they are equivalent. If the two structures are different, it will display the place

Re: Fwd: [EMAIL PROTECTED]: Re: fixing is_deeply]

2005-07-02 Thread Michael Peters
demerphq wrote: I wasn't suggesting that this should fail and wouldnt suggest it should either. I was suggesting that my $a=[]; is_deeply([$a,$a],[[],[]]) So doesn't that just come down to is_deeply([], []) failing? Can we really say that x=y; but x,x != y,y? If that is the case, the it

Re: Fwd: [EMAIL PROTECTED]: Re: fixing is_deeply]

2005-07-02 Thread demerphq
On 7/2/05, Fergal Daly [EMAIL PROTECTED] wrote: Here's a way of looking at it that doesn't require you to consider what happens if you alter the structures. Let's say you have a Person class with a Name an Age and a House class with Owner and Resident. Now imagine there are 2 people who

Re: Fwd: [EMAIL PROTECTED]: Re: fixing is_deeply]

2005-07-02 Thread Ovid
--- demerphq [EMAIL PROTECTED] wrote: You are playing on some TV gameshow. You've won the big prize: a house. Now the thing is that the presenter gives you a choice of two envelopes. Both contain two house addresses. However one contains the same address twice and the other contains two

Re: Fwd: [EMAIL PROTECTED]: Re: fixing is_deeply]

2005-07-02 Thread Andrew Pimlott
On Sat, Jul 02, 2005 at 08:55:34AM +0200, demerphq wrote: The entire basis of computer science is based around the idea that if you do the same operation to two items that are the same the end result is the same. Citing computer science as the basis of your position is just too much. The

Re: Fwd: [EMAIL PROTECTED]: Re: fixing is_deeply]

2005-07-02 Thread Fergal Daly
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

Re: Fwd: [EMAIL PROTECTED]: Re: fixing is_deeply]

2005-07-02 Thread Fergal Daly
On 7/2/05, Andrew Pimlott [EMAIL PROTECTED] wrote: On Sat, Jul 02, 2005 at 08:55:34AM +0200, demerphq wrote: The entire basis of computer science is based around the idea that if you do the same operation to two items that are the same the end result is the same. Citing computer science

Re: Fwd: [EMAIL PROTECTED]: Re: fixing is_deeply]

2005-07-02 Thread Michael G Schwern
On Sat, Jul 02, 2005 at 09:50:24AM -0700, Andrew Pimlott wrote: Finally, I think that comparing functions (which started this discussion) is insane! You haven't done much testing of serialization. -- Michael G Schwern [EMAIL PROTECTED] http://www.pobox.com/~schwern Reality is that

Re: Fwd: [EMAIL PROTECTED]: Re: fixing is_deeply]

2005-07-02 Thread Michael G Schwern
On Sat, Jul 02, 2005 at 09:18:30AM -0700, Ovid wrote: In short, I think most agree that we're talking about two separate things and that neither is wrong, so if someone wants to pitch a solution rather than continue a long email chain, I'm sure we'd be grateful :) Seconded! Go code

Re: Fwd: [EMAIL PROTECTED]: Re: fixing is_deeply]

2005-07-02 Thread Andrew Pimlott
On Sat, Jul 02, 2005 at 07:34:47PM +0100, Fergal Daly wrote: On 7/2/05, Andrew Pimlott [EMAIL PROTECTED] wrote: Citing computer science as the basis of your position is just too much. The computer science answer to the comparison of references is that they are equal if and only if they are

Re: Fwd: [EMAIL PROTECTED]: Re: fixing is_deeply]

2005-07-01 Thread demerphq
On 7/1/05, Michael G Schwern [EMAIL PROTECTED] wrote: After talking with Ovid some in the kitchen I'm of the opinion that is_deeply() is currently doing the right thing and that these tests cannot go. Largely it comes down to the Principle of Least Surprise. I cant agree with this analysis.

Re: Fwd: [EMAIL PROTECTED]: Re: fixing is_deeply]

2005-07-01 Thread demerphq
On 7/1/05, demerphq [EMAIL PROTECTED] wrote: The question you have to ask yourself is why should a reference be treated different from any other value? It is a VALUE. IE: why should In the following part i meant to make it more clear: by changing this line $x=1;$y=2;$z=3; to $x=1;

Re: Fwd: [EMAIL PROTECTED]: Re: fixing is_deeply]

2005-07-01 Thread Smylers
demerphq writes: On 7/1/05, Michael G Schwern [EMAIL PROTECTED] wrote: ... I'm of the opinion that is_deeply() is currently doing the right thing ... Largely it comes down to the Principle of Least Surprise. I cant agree with this analysis. If you go down this route surprise abounds.

Re: Fwd: [EMAIL PROTECTED]: Re: fixing is_deeply]

2005-07-01 Thread Michael G Schwern
On Fri, Jul 01, 2005 at 08:28:30AM +0200, demerphq wrote: After talking with Ovid some in the kitchen I'm of the opinion that is_deeply() is currently doing the right thing and that these tests cannot go. Largely it comes down to the Principle of Least Surprise. I cant agree with this

Re: Fwd: [EMAIL PROTECTED]: Re: fixing is_deeply]

2005-07-01 Thread Ovid
--- Piers Cawley [EMAIL PROTECTED] wrote: I've always thought of Cis_deeply as being about the 'shape' of a data structure. When you think of things in this way, then it seems obvious that given $a = [], $b = [], $c = [] then [$a, $a] and [$b, $c] have substantially different shapes.

Re: Fwd: [EMAIL PROTECTED]: Re: fixing is_deeply]

2005-07-01 Thread Michael G Schwern
On Fri, Jul 01, 2005 at 10:28:29AM -0700, Ovid wrote: So, just for the sake of argument, imagine I write a class where I periodically returns array refs to the user. I do this by building them every time they're called. Later, I realize that my methods are deterministic so I start caching

Re: Fwd: [EMAIL PROTECTED]: Re: fixing is_deeply]

2005-07-01 Thread _brian_d_foy
In article [EMAIL PROTECTED], Demerphq [EMAIL PROTECTED] wrote: On 7/1/05, Michael G Schwern [EMAIL PROTECTED] wrote: After talking with Ovid some in the kitchen I'm of the opinion that is_deeply() is currently doing the right thing and that these tests cannot go. Largely it comes down to

Re: Fwd: [EMAIL PROTECTED]: Re: fixing is_deeply]

2005-06-30 Thread Yitzchak Scott-Thoennes
On Thu, Jun 30, 2005 at 05:09:39PM -0700, Michael G Schwern wrote: So, I conclude that is_deeply()'s behavior is ok and something like Test::Deep should be enhanced with an option to deal with this problem. So, am I correct in understanding that is_deeply will only notice value differences,