develooper Front page | perl.perl5.porters | Postings from August 2008

Re: [PATCH] Add open "|-" and open "-|" to perlopentut

Thread Previous
From:
H.Merijn Brand
Date:
August 25, 2008 10:05
Subject:
Re: [PATCH] Add open "|-" and open "-|" to perlopentut
Message ID:
20080825190530.74e42359@pc09.procura.nl
On Mon, 25 Aug 2008 10:53:55 -0600, Tom Christiansen <tchrist@perl.com>
wrote:

> In-Reply-To: Message from "H.Merijn Brand" <h.m.brand@xs4all.nl> 
> 	     of "Mon, 25 Aug 2008 11:36:22 +0200." 
>              <20080825113622.0eafe8ba@pc09.procura.nl> 
> 
> > On Mon, 25 Aug 2008 02:35:24 -0600, [I,] Tom Christiansen
> > <tchrist@perl.com>, wrote:
> 
> >>> I converted the '|-' example to "lpr".  
> >> 
> >> Nice to see better quotes.
> 
> >>>> Finally, should these examples be included *before* the
> >>>> references to IPC::Open2 and perlipc?  
> >> 
> >>> Don't know.  
> >> 
> >> No.
> 
> >>> New patch attached.  
> 
> >> How delightful: politically-correct Bow[d]lerization in programming
> >> languages' documentation.  Must we fiddle about with t's that are
> >> already crossed whilst Rome is burning?
> 
> >> For the record, and if I were to fix it back up so it actually reads as
> >> I write (and would see other[s] write) again, I'd certainly make doubly
> >> [sure] always to use double-quotes in all places other than those scant
> >> few that have just cause to see interpolation suppressed.
> 
> > I have had my disputes with you, but I wholeheartedly agree with you
> > for 100% on the use of double quotes here!
> 
> I'm glad that, despite producing so long a missive--nay, arguably more 
> of a document than a simple letter--more riddled with typos than a 
> moth-eaten old sweater is with holes, I still managed to convey my 
> point in a convincingly persuasive manner.  But such are the perils 
> of writing in those wee small hours of the unborn day.
> 
> The argument for using double quotes over singles distills down to two
> major points, the first simple and the second subtler:
> 
>     1) They're easier to read because they're wider, dodging also the 
>        late-night `grave-vs-acute' quandary of dim vision or bad fonts.
> 
>     2) Perl is fundamentally *interpolative* by nature, and so its default
>        behaviour--one seen in many, many places--is to interpolate; forever
>        fighting against that nature is more trouble than it's worth.
> 
> Interpolated strings literals are no different in this regard than many
> another construct in Perl.  Indeed, in places other than strings, Perl's
> inherently interpolative nature may be suppressed only via incantations
> substantially more convoluted (read: uglier) than resorting to single quotes.
> 
> Reserve therefore the special, *suppressive* syntax for that rare occasion
> when you genuinely require it.  Do not use it out of mindless habit and so
> needlessly force the reader to try to discern whether you *meant* to
> suppress something, what that was, and why.
> 
> Plus, that path also avoids confusing both shell and C programmer alike, 
> who expect and intend \t or \n to mean but single characters, not doubles.
> 
> Lastly, if you start out with single quotes, you'll too often have to
> change the whole thing when you later find yourself needing to include
> some backslashed character or a variable.  By using double quotes from 
> the onset, you save yourself work in the future, and perhaps also run 
> less risk of error.

This last point was my primary reason to take this policy years ago.
And as a second choice I revert to using q{} and qq{} instead of single
quotes to make that deliberate choice obvious in that part of the code.

> --tom
> 
> PS: I know: those final two paragraphs could count as points 3 and 4. 
>     But these are a minor pair of points compared with the major pair.


-- 
H.Merijn Brand          Amsterdam Perl Mongers  http://amsterdam.pm.org/
using & porting perl 5.6.2, 5.8.x, 5.10.x, 5.11.x on HP-UX 10.20, 11.00,
11.11, 11.23, and 11.31, SuSE 10.1, 10.2, and 10.3, AIX 5.2, and Cygwin.
http://mirrors.develooper.com/hpux/           http://www.test-smoke.org/
http://qa.perl.org      http://www.goldmark.org/jeff/stupid-disclaimers/

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About