Re: CodingGuidelines Perl amendment

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: CodingGuidelines Perl amendment

From: Ted Zlatanov <hidden>
Date: 2016-06-15 22:56:04

On Wed, 06 Feb 2013 08:29:30 -0800 Junio C Hamano [off-list ref] wrote: 

JCH> Is it ever (as opposed to "not always") possible to omit braces?

Oh yes!  Not that I recommend it, and I'm not even going to touch on
Perl Golf :)

JCH> It sounds as if we encourage the use of statement modifiers, which
JCH> certainly is not what I want to see.

Yup.  I think I captured that in the patch, but please feel free to
revise it after applying or throw it back to me.

JCH> You probably would want to mention that opening braces for
JCH> "if/else/elsif" do not sit on their own line, and closing braces for
JCH> them will be followed the next "else/elseif" on the same line
JCH> instead, but that is part of "most of the C guidelines above apply"
JCH> so it may be redundant.

OK; done.
quoted
- Don't abuse statement modifiers (unless $youmust).
JCH> It does not make a useful guidance to leave $youmust part
JCH> unspecified.

JCH> Incidentally, your sentence is a good example of where use of
JCH> statement modifiers is appropriate: $youmust is rarely true.

I was trying to be funny, honestly.  But OK; reworded.

Ted

Re: CodingGuidelines Perl amendment

From: demerphq <hidden>
Date: 2016-06-15 22:56:04

On 6 February 2013 19:05, Ted Zlatanov [off-list ref] wrote:
On Wed, 06 Feb 2013 08:29:30 -0800 Junio C Hamano [off-list ref] wrote:

JCH> Is it ever (as opposed to "not always") possible to omit braces?

Oh yes!  Not that I recommend it, and I'm not even going to touch on
Perl Golf :)
I think you are wrong. Can you provide an example?

Larry specifically wanted to avoid the "dangling else" problem that C
suffers from, and made it so that blocks are mandatory. The only
exception is statement modifiers, which are not only allowed to omit
the braces but also the parens on the condition.

Yves


-- 
perl -Mre=debug -e "/just|another|perl|hacker/"
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help