[PATCH 0/6] Re: cleanups for git-send-email
- From
- Nicolas Sebrecht <nicolas.s.dev@gmail.com>
- Date
- Apr 29, 2009, 22:27 UTC
- Message-ID
- <20090429222711.GC12908@vidovic>
- In-Reply-To
- <20090429194852.0976257034@viridian.itc.Virginia.EDU>
On Wed, Apr 29, 2009 at 03:48:51PM -0400, Bill Pemberton wrote:
> Again, it prevents bugs. People use "and" vs "&&" as the same thing, > when they are not. The have different precedence in perl.
I agree with you except that the chapter 4.16 from the Perl Best Practices book does not apply here. FMPOV, we don't really mix booleans because the precedence is explicitly given by the parentheses.
[ Notice _how_ the author raises the ambiguity to explain his point in the book: he uses parentheses. ]
Show 6 quoted lines
> For example, > > next if not $finished || $x < 5; > next if !$finished || $x < 5; > > do not mean the same thing.
True. But the lines we are talking about are different. We have:
next if ($finished or $x < 5);
If we add a "not"/"!" or append a "&&"/"and" - or whatever -, we do know what will be evaluated easily:
next if !($finished or $x < 5);
looks rather different from
next if (!$finished or $x < 5);
-- Nicolas Sebrecht