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

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

Thread Previous | Thread Next
David Nicol
September 7, 2008 16:38
Re: unless(...) terser than if(!...)
Message ID:
On Sun, Sep 7, 2008 at 4:59 PM, Nicholas Clark <> 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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About