git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Ericsson <ae@op5.se>
To: Nicolas Sebrecht <nicolas.s.dev@gmail.com>
Cc: Bill Pemberton <wfp5p@viridian.itc.Virginia.EDU>,
	Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org
Subject: Re: [PATCH 0/6] Re: cleanups for git-send-email
Date: Thu, 30 Apr 2009 10:11:15 +0200	[thread overview]
Message-ID: <49F95D23.3050101@op5.se> (raw)
In-Reply-To: <20090429222711.GC12908@vidovic>

Nicolas Sebrecht wrote:
> 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.

      reply	other threads:[~2009-04-30  8:11 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-29 13:12 [PATCH 0/6] cleanups for git-send-email Bill Pemberton
2009-04-29 13:12 ` [PATCH 1/6] Remove return undef from validate_patch Bill Pemberton
2009-04-29 13:12   ` [PATCH 2/6] Remove function prototypes from git-send-email.perl Bill Pemberton
2009-04-29 13:12     ` [PATCH 3/6] Remove return undef from ask() Bill Pemberton
2009-04-29 13:12       ` [PATCH 4/6] Add explict return to end of subroutines Bill Pemberton
2009-04-29 13:12         ` [PATCH 5/6] Remove mix of high and low-precedence booleans Bill Pemberton
2009-04-29 13:12           ` [PATCH 6/6] Remove bareword filehandles in git-send-email.perl Bill Pemberton
2009-05-03 20:58             ` Jeff King
2009-05-03 21:34               ` Francis Galiegue
2009-05-04  6:12                 ` H.Merijn Brand
2009-05-04  6:53                   ` Francis Galiegue
2009-05-04  7:41                     ` H.Merijn Brand
2009-04-29 16:54           ` [PATCH 5/6] Re: Remove mix of high and low-precedence booleans Nicolas Sebrecht
2009-04-29 17:00             ` Bill Pemberton
2009-05-03 20:31         ` [PATCH 4/6] Add explict return to end of subroutines Jeff King
2009-05-03 20:26       ` [PATCH 3/6] Remove return undef from ask() Jeff King
2009-05-04  2:26         ` Jay Soffian
2009-05-03 20:27     ` [PATCH 2/6] Remove function prototypes from git-send-email.perl Jeff King
2009-05-03 19:46   ` [PATCH 1/6] Remove return undef from validate_patch Jeff King
2009-04-29 19:18 ` [PATCH 0/6] cleanups for git-send-email Junio C Hamano
2009-04-29 19:48   ` Bill Pemberton
2009-04-29 20:23     ` Junio C Hamano
2009-04-29 22:27     ` [PATCH 0/6] " Nicolas Sebrecht
2009-04-30  8:11       ` Andreas Ericsson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49F95D23.3050101@op5.se \
    --to=ae@op5.se \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=nicolas.s.dev@gmail.com \
    --cc=wfp5p@viridian.itc.Virginia.EDU \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).