develooper Front page | perl.perl5.porters | Postings from September 2008

Re: unless(...) terser than if(!...)

Thread Previous | Thread Next
From:
David Nicol
Date:
September 7, 2008 16:38
Subject:
Re: unless(...) terser than if(!...)
Message ID:
934f64a20809071638u10c58927vdb2503aaa0c1393b@mail.gmail.com
On Sun, Sep 7, 2008 at 4:59 PM, Nicholas Clark <nick@ccl4.org> wrote:

> But I feel no such qualms about a major release - using overloading to make
> your value both true and false strikes me as crazy. Really anything that
> deliberately has implementation inconsistencies between semantically equivalent
> actions (such as $a = $a + 1; $a += 1; ++$a;) is in my mind bad practice and
> foolhardy to rely on in perpetuity.
>
> Nicholas Clark

But the thing about operator overloading is, coming from C++, the idea
is to use the existing syntax for things that are totally different,
for instance the bitwise shift operators in C++ getting used for
stream IO.

It's easy to imagine  someone overloading prefix bang to mean, for
instance "ALL CAPS" knowing that unary not is never going to apply to
their string object class.




-- 
off-topic notices are almost universally, themselves, off topic.

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