develooper Front page | perl.perl5.porters | Postings from March 2014

Re: [perl #121230] process group kill on Win32 broken in 5.17.2,regression 5.18

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
March 18, 2014 12:06
Subject:
Re: [perl #121230] process group kill on Win32 broken in 5.17.2,regression 5.18
Message ID:
20140318120359.GK1615@iabyn.com
On Mon, Mar 17, 2014 at 02:43:56PM -0700, bulk88 via RT wrote:
> Everything is fine in that except 1 thing.
> 
> Why replace the single quotes with double quotes for the sake of using
> double quotes? I've always assume double quotes take longer for the
> compiler to parse than single quotes, and using double quotes without
> knowing why leads to a larger change of unintended code
> execution/interpolation.

The difference in parsing time between single and double quotes strings is
infinitesimal and should not be a consideration in a small test file,
especially one that does a lot of forking and sleeping.

So I went for readability. IMO,

    "that's all"
    
is much easier for the brain to parse than

    q|that's all|

since the '|' character in perl isn't normally associated with string
delimiting.

The choice of single verses double-quoted is debatable. It can cause
errors either way. For example someone later modifying your version might
accidentally add:

    q|that's all, $person|

while someone modifying my code might do

    "that's all you get for $100"

In either case, if the programmer doesn't check the quotedness of string
before modifying it, they get everything they deserve.



-- 
A power surge on the Bridge is rapidly and correctly diagnosed as a faulty
capacitor by the highly-trained and competent engineering staff.
    -- Things That Never Happen in "Star Trek" #9

Thread Previous | Thread Next


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