develooper Front page | perl.perl5.porters | Postings from December 2007

Re: 5.11 (or 12) and strict

Thread Previous | Thread Next
From:
Michael G Schwern
Date:
December 27, 2007 20:41
Subject:
Re: 5.11 (or 12) and strict
Message ID:
47747E6F.9020807@pobox.com
Sean O'Rourke wrote:
> And even
> if you do, do you think that a language should impose coding
> standards (which is what strict boils down to) on its users?  For
> example should C compilers complain if a user doesn't indent
> blocks?

As chromatic has been (pointing|jabbing) out, lots of language decisions
amount to stylistic decisions.  Are variables case-sensitive?  Do they have a
limit?  What character set can you use?  Are we going to allow goto LABEL?
What about do/while loops?  Ternary operators? [1]  C or iterator style for
loops?  Do you need a semicolon at the end of every statement?  Are class
names case sensitive?  Do we use a . or -> for method calls?  Do we allow OO?
 Function references?  Post-compile time code modification?  Is everything an
object?  Is there a type system?  Do you have to manually cast between types?
 Do strings interpolate?  What do they interpolate?  What are the core data
types?  Are strings arrays of characters?  Are hashes a basic data type or
maybe trees instead?  Are we putting regexes into the language?  How deeply
tied in?

Do variables need to be declared?  Can I reference a variable by name using
another variable?  Do I have to declare a subroutine before I use it as a
bareword?

All of these "features" effect your programming style.  The last pile being
the set of features decided by strict.  This is a set of features that was
decided on 20 years ago and turned out to be not such a good idea.  They're
generally dangerous and require some thought before being used. [2]  So we'd
like to change those features.

In Perl the easy things should be easy.  In good design the right thing should
be easy, easier than the wrong thing as people will tend to do the easy thing
before the right thing.  Also in fine Perl tradition, the hard things should
be possible.  Not just possible, but almost as easy as the easy thing, once
you put a little thought into it.  I think 10 little characters, "no strict;",
is about as easy as you can get for a hard thing.

Finally, to put things into perspective, issues of whitespace, indentation and
naming conventions are stylistic issues which are still in high contention and
require a lot of situational flexibility.  We like flexibility in Perl.  The
utility of declaring variables, and when you might want to turn that off, is
pretty much a done argument.  Leaving off "my" is a false laziness at the
expense of time lost hunting down typos.

If nothing else it's telling (and I'm pleasantly surprised) that so much of
p5p, a normally very conservative bunch, is in favor.


[1] Anyone who had to sit through Guido drone on about the decision not to put
ternary operators into Python at an OSCON keynote understands.

[2] It's interesting to note that the arguments against have centered around
the apparently authoritarian and stylistic nature of the change rather than
whether or not it's actually a good idea.


-- 
ROCKS FALL! EVERYONE DIES!
	http://www.somethingpositive.net/sp05032002.shtml

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