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

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

Thread Previous | Thread Next
From:
Mark A. Biggar
Date:
July 14, 2006 07:56
Subject:
Re: ===, =:=, ~~, eq and == revisited (blame ajs!) -- Explained
Message ID:
44B7B053.9000802@biggar.org
Darren Duncan wrote:
> Now, I didn't see them yet anywhere in Synopsis 3, but I strongly 
> recommend having negated versions of all these various types of equality 
> tests.  Eg, !== for ===, nev for eqv, etc.  They would be used very 
> frequently, I believe (and I have even tried to do so), and of course we 
> get the nice parity.

Yes and they should be strictly implicitly defined in term of the 
positive versions in such a way that you can't explicitly redefine them 
separately.  I.e., $x !== $y should always mean exactly the same thing 
as !($x === $y).  Maybe by a macro definition. To do otherwise would be 
very confusing as it would make such simple program transformations as:

say "foo" if $x !== $y;

into

say "foo" unless $x === $y;

very unreliable.

Actually a similar argument could be made about '<' vs '>', '>=' and 
'<=' in other words just redefining '==' & '<' should automatically get 
you '!=', '<=', '>=' and '>'.

-- 
mark@biggar.org
mark.a.biggar@comcast.net

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