develooper Front page | perl.perl5.porters | Postings from April 2010

Re: RFC: Perl manual pages -- update to follow the perlstyle.pod guidelines

Thread Previous | Thread Next
Tom Christiansen
April 4, 2010 08:48
Re: RFC: Perl manual pages -- update to follow the perlstyle.pod guidelines
Message ID:
In-Reply-To: Message from Marvin Humphrey <>
   of "Sun, 04 Apr 2010 08:13:12 PDT." <>

>> I don't read function calls without a ) as having their arguments term<SNIP>
>> The ) || works much, much, much better for me.

>> I always use ||.  Always.  And I do *not* make precedence errors, because
>> even if I forgot them, I also always use ).

> Wouldn't that usage of "||" instead of "or" be a personal idiosyncrasy, then?

I doubt it's all that personal.

> (Presumably an artifact of your C background?)  I'm agnostic about the
> readability, but as a language construct, "or" is more appropriate.

> FWIW, I also always use parens around the arguments to open, for much the same
> reasons that you do (though I don't typically use parens for "close").  

> But I always use low-precedence "or" because the "or die" idiom was
> drilled into my head by Perl canon literature.

That depends on your literary predilections, I suppose.

>  open(my $fh, '<', 'foo.txt') or die $!;
>  ...
>  close $fh or die $!;

> So even if we don't strip the parens, what's wrong with using "or" instead 
> of "||"?


I'm a far stronger advocated of parens around arguments than I am for ||.
If you use parens, it doesn't matter which or or || you use.  I find
I read things a lot easier with punctuation that without.  Lack of grouping
punctuation makes things harder to read.

You don't address the problem of having too many tricky levels of precedence
by creating two more levels of precedences.  That's what clever people to do,
and it just makes the problem worse.

You solve it by using parens.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About