git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 0/6] Re: cleanups for git-send-email

From
Andreas Ericsson <ae@op5.se>
Date
Apr 30, 2009, 08:11 UTC
Message-ID
<49F95D23.3050101@op5.se>
In-Reply-To
<20090429222711.GC12908@vidovic>
Nicolas Sebrecht wrote:
Show 32 quoted lines
> 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. ]
> 
>> 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);
> 

I'm rather clueless when it comes to perl coding, but I know what I don't know, so I've got enough sense to look these things up whenever I have to hack some perl. I hope others do the same.

Personally, I've found that never using 'or', 'not' or 'and', and overparenthesize when I'm uncertain seems to work rather nicely, even though perl gurus would probably shunt my code as overly explicit.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Register now for Nordic Meet on Nagios, June 3-4 in Stockholm
 http://nordicmeetonnagios.op5.org/

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.
Previous: Nicolas Sebrecht
Message 24 of 24 in “cleanups for git-send-email”
  1. 0/6 cleanups for git-send-emailBill Pemberton, Apr 29, 2009
  2. 1/6 Remove return undef from validate_patchBill Pemberton, Apr 29, 2009
  3. 2/6 Remove function prototypes from git-send-email.perlBill Pemberton, Apr 29, 2009
  4. 3/6 Remove return undef from ask()Bill Pemberton, Apr 29, 2009
  5. 4/6 Add explict return to end of subroutinesBill Pemberton, Apr 29, 2009
  6. 5/6 Remove mix of high and low-precedence booleansBill Pemberton, Apr 29, 2009
  7. 6/6 Remove bareword filehandles in git-send-email.perlBill Pemberton, Apr 29, 2009
  8. Jeff KingMay 3, 2009
  9. Francis GaliegueMay 3, 2009
  10. H.Merijn BrandMay 4, 2009
  11. Francis GaliegueMay 4, 2009
  12. H.Merijn BrandMay 4, 2009
  13. 5/6 Re: Remove mix of high and low-precedence booleansNicolas Sebrecht, Apr 29, 2009
  14. Bill PembertonApr 29, 2009
  15. Jeff KingMay 3, 2009
  16. Jeff KingMay 3, 2009
  17. Jay SoffianMay 4, 2009
  18. Jeff KingMay 3, 2009
  19. Jeff KingMay 3, 2009
  20. Junio C HamanoApr 29, 2009
  21. Bill PembertonApr 29, 2009
  22. Junio C HamanoApr 29, 2009
  23. 0/6 Re: cleanups for git-send-emailNicolas Sebrecht, Apr 29, 2009
  24. Andreas EricssonApr 30, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.