From: wfp5p@viridian.itc.Virginia.EDU (Bill Pemberton)
To: gitster@pobox.com (Junio C Hamano)
Cc: git@vger.kernel.org
Subject: Re: [PATCH 0/6] cleanups for git-send-email
Date: Wed, 29 Apr 2009 15:48:51 -0400 (EDT) [thread overview]
Message-ID: <20090429194852.0976257034@viridian.itc.Virginia.EDU> (raw)
In-Reply-To: <7vws939skl.fsf@gitster.siamese.dyndns.org>
> Perl styles are highly personal.
>
So are C styles, but the kernel and git doesn't allow all sorts of
mixed styles. My changes are also not just coding style, they have
actual meaning in perl.
My changes come directly from the book "Perl Best Practices". Just as
you do things like "don't allow assignment in conditionals" in C, even
though it's legal. There are good reasons to do these things in perl
to prevent bugs down the road.
>
> *1* ...except for the "and/or vs &&/||" bits, even though I prefer the
> latter myself solely because I am old fashioned.
>
Again, it prevents bugs. People use "and" vs "&&" as the same thing,
when they are not. The have different precedence in perl.
For example,
next if not $finished || $x < 5;
next if !$finished || $x < 5;
do not mean the same thing.
> I think it is simply silly to say "precedence of ! and and/or does not
> mix". "!" and "&&" have different precedence and rewriting (A and !B)
> into (A && !B) would not make things any better nor worse. After all,
> nobody would have problems with "$a + $b * $c" even though + and * have
> different precedence.
>
It's not that ! and && have different precedence. It's that "not" and
! have different precedence. Using your math example, it would be
like having an operator named plus that had a higher precedence than
"*". Now if you wrote "$a plus $b * $c" it would have different
result than "$a + $b * $c".
> Oh, I also do not agree with "always explicitly return". If the change
> and explanation were limited to the subs whose return values are _used_, I
> would agree with the change, though.
>
Again, it prevents potential bugs down the road. Currently those
functions return something. While they are not used, the something
they return can be interpreted by developers as an intentional return
value and that property may get used. If some other developer changes
the original function in some way that the implicit return becomes
something else, it'll create a bug. If a subroutine isn't supposed to
return a meaningful value, it should do it explicitly.
--
Bill Pemberton wfp5p@virginia.edu
ITC/Unix Systems flash@virginia.edu
University of Virginia
next prev parent reply other threads:[~2009-04-29 19:49 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 [this message]
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
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=20090429194852.0976257034@viridian.itc.Virginia.EDU \
--to=wfp5p@viridian.itc.virginia.edu \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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).