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

Re: [DOC] Modernization: perlsyn

Thread Previous | Thread Next
From:
Elizabeth Mattijsen
Date:
August 30, 2009 14:48
Subject:
Re: [DOC] Modernization: perlsyn
Message ID:
8D6AF68A-8A3B-4FF3-89EE-A8A1651DFE55@dijkmat.nl

On Aug 30, 2009, at 11:34 PM, Abigail wrote:
> On Sat, Aug 29, 2009 at 09:04:43PM -0400, Christopher Nehren wrote:
>> FWIW, it probably makes sense to use the style documented in  
>> perlstyle
>> where it's applicable (and in line with the current goals), for the  
>> sake
>> of consistency. For this issue, perlstyle suggests the rather  
>> Strunkian
>> "Omit redundant punctuation as long as clarity doesn’t suffer." We
>> should strive to be consistent above all else, so as to enhance  
>> clarity
>> and reduce confusion.
> Actually, I'm not so sure I agree with the "We should strive to be
> consistent". Perl allows you to do things in more than one way. Hence,
> the documentation shouldn't shy away from showing multiple ways to do
> things. I'd say that if to do X, one commonly finds three ways of  
> doing
> things (for instance $hash {BAR}, $hash {'BAR'}, and $hash {"BAR"}),
> it would be OK for the documentation to use all three styles, and we
> shouldn't pick one style and exclude the other three.

Should we mention that you can write any variable like $foo also as $ 
{foo}?  Or even as ${"foo"} if you don't have strict enabled?

There is such a thing as taking it too far with TIMTOWTDI.

I'd rather would want to try to approach perlsyn more as a grammar,  
where you specify that the key to a hash may be a STRING, where string  
is either FOO, 'FOO' or "FOO".  And perhaps mention that you *must*  
quote the string if there can be confusion with a (builtin) function:

$ perl -Mwarnings -le '$a{shift}="bar"; print $a{"shift"}' foo
bar


> Exclude things that are uncommon, illogical, or inefficient. But don't
> go for "consistent above all else". That's Pythons turf, not Perls.

I think part of the modernization of the documentation *should* be to  
make things more consistent.  And if there is a "best practice", then  
only that practice should generally be mentioned.  Regardless of any  
other programming language out there.



Liz
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