develooper Front page | perl.perl6.language | Postings from July 2006

Re: ===, =:=, ~~, eq and == revisited (blame ajs!) -- Explained

Thread Previous | Thread Next
Dave Whipp
July 14, 2006 09:49
Re: ===, =:=, ~~, eq and == revisited (blame ajs!) -- Explained
Message ID:
Darren Duncan wrote:

> Assuming that all elements of $a and $b are themselves immutable to all 
> levels of recursion, === then does a full deep copy like eqv.  If at any 
> level we get a mutable object, then at that point it turns into =:= (a 
> trivial case) and stops.

   ( 1, "2.0", 3 ) === ( 1,2,3 )

True or false?

More imprtantly, how do I tell perl what I mean? The best I can think of is:

   [&&] (@a »==« @b)
   [&&] (@a »eq« @b)

But this only works for nice flat structures. For arbitrary tree 
structures, we probably need adverbs on a comparison op (I think Larry 
mentioned this a few posts back) ... but if we're going with adverbs do 
we really need 5 different base operators? Are all of the 5 so common 
that it would be clumbersome to require adverbs for their behavior?

Also, when sorting things, maybe deep inequalities would be useful, too.

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About