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

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

Thread Previous | Thread Next
From:
Dr.Ruud
Date:
July 14, 2006 14:39
Subject:
Re: ===, =:=, ~~, eq and == revisited (blame ajs!) -- Explained
Message ID:
20060714213903.14170.qmail@lists.develooper.com
Darren Duncan schreef:
> Dr.Ruud:

>>>    say "foo" if $x !== $y;
>>> into
>>>    say "foo" unless $x === $y;
>>
>> And how about symmetry:
>>    say "foo" unless $y === $x;
>
> Any equality or inequality operator is commutative,

If $x and $y are not of the same type, and one or both of the involved
types has its own (or overloaded?) 'deep equality operator', the choice
(which implementation is used) can depend on the order.

Not so long ago, there was an issue with Perl5 in this area (IIRC with
'==' and undef).


> so it doesn't
> matter whether you have $x and $y or $y and $x, the result is the
> same.  So you can use whichever order you want without it needing to
> be coded for. -- Darren Duncan

-- 
Affijn, Ruud

"Gewoon is een tijger."



Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About