>>>>> "Nick" == Nick Cleaton <[EMAIL PROTECTED]> writes:

Nick> On Mon, Jan 21, 2002 at 09:00:56AM +0000, Piers Cawley wrote:

>> $cond1 && action1() ||
>> $cond2 && action2() ||
>> ...
>> 
>> works just as 'well'...

Nick> Until the day that $cond1 is true and action1() returns '0',
Nick> when it breaks mysteriously.

Which is why I categorically fail anyone who does that, or this:

        $foo and true_thing() or false_thing();

on a code review.  I can't believe how often this broken meme (and
in what forms) it gets reused.

Sure, *you* might know that "true_thing" can never return a false
value, but the guy maintaining it might not know that's why it works,
and either accidentally or deliberately break it.

When I see code like that, I say "do this in the privacy of your
own cubicle to amuse yourself, but please don't let it leak out".
It'd be like mistaking "golf" entries or JAPHs for real code.  Fine
as a toy, never for production.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

Reply via email to