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 example.  In fact, I would say
it's symmetric.  I'm calling the same code on each.  What is your
definition?  I would guess your definition is either circular, or would
restrict one to an unrealistically small subset of Perl.  In the real
world, code like the above is perfectly normal.

Again, your form of equality is perfectly good, but it's not privileged
over any other.  Both your equality and is_deeply are belied by totally
normal, plausible code.  That's all I wanted to point out.

> > You would have to go further and say that the two structures are the
> > "only things" on those two computers, or that they are entangled with
> > other data (including the symbol table!) in the "same" ways.  
> 
> Id like to see an explanation for this assertion. 

As per the above example, things outside of the structures may hold
references into them.  So if the two structures are to act the same,
they must have the same things holding references to them.  And so on.

> >     Two structures are considered to be the same if you could not
> >     observe the difference without using a) finding the address of a
> >     reference, b) reference comparison, or c) variable assignment.
> 
> Do you think this is the way is_deeply() behaves? Its not actually.

I could believe I've missed something, but I'm curious what.

> > All I'm saying is, drop the pretense that this other comparison is
> > better according to some higher theoretical principle.  
> 
> Well i wont drop the pretense. I say its better because it contains
> less room for inconsistancy.

I can agree with the second without agreeing to the first.

> my $foo='foo';
> deep_eq('foo',$foo);
> 
> failed. At first i was surprised, then i remembered that one of the
> properties being checked is if  elements are similarly readonly().
> 
> I say that there are situations where such a test is very valuable.

I agree.

Andrew

Reply via email to