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

Re: 5.11 (or 12) and strict

Thread Previous | Thread Next
Michael G Schwern
December 26, 2007 20:43
Re: 5.11 (or 12) and strict
Message ID:
Steffen Mueller wrote:
> I'm sure this proposal will be shot down in a second and I'll be banned
> from posting to perl5-porters again*, but I'd never forgive myself for
> not trying:
> Personally, I've always wanted perl to have strictures on by default for
> my code. I would think that 95% of all code bases which were written in
> this century and which are of non-negligible size import "strict". I
> don't use strictures for one-liners, of course, but for anything else
> it's a must. It seems to me like others have similar views on this. Try
> posting some code without "use strict" to some newsgroup or forum and
> ask for help. Make sure not to give out your email address, though.
> "use 5.10.0;" already auto-imports and loads the 5.10
> specific features.
> How about having "use 5.11.0;" (or 5.12.0) automatically import strict
> along with the 5.10+5.11 feature set? Naturally, the -E switch for
> one-liners should *not* do that.
> This would *not* break backwards compatibility. This would not affect
> one-liners. This would optimize for the common case: If you write enough
> code to make importing optional features worthwhile, odds are very high
> you'd be importing "strict" anyway. The 5% who need to disable
> strictures again can still add a "no strict;" statement.
> strictures-correct code has been best-practice for a long time now.
> Let's make it the default for *new* code.


This came up years ago when we were first discussing Perl 6 (back when it was
"let's just break a wee bit of compatibility with Perl 5).  Folks wanted
strict and warnings on by default.

The points of contention back then were:
A) one-liners
B) short, sloppy scripts
C) compatibility
D) some folks didn't like strict

I think your proposal handles all that.  strict is, finally, unarguably good
practice and turning it off should be the decision, not turning it on.
One-liners can be excepted via -E.  Short scripts likely aren't going to
bother saying "use 5.012" and if they do it indicates that the person knows
enough Perl that they can declare some variables (and honestly, I make as many
typos in short scripts as I do in long ones).  And compatibility is addressed
by the "feature" system.

Stabbing you in the face for your own good.

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