So I did it. I proposed to the perl5-porters that we should enable "use strict" by default for some future code. This may be a little less preposterous than it sounds at first, so please wait with hitting the "reply" button until you read the whole of this.
My proposal basically goes as follows:
I'll include my original rationale here:
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 feature.pm 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.
Just think of strictures as a feature. It just makes sense.
To my surprise, the proposal has been received with very positive feedback. So I wrote the patch.
With some luck, we'll get strictures by default in 5.12! Flame away!
Cheers,
Steffen
It's anti-Perl. Leave aside the logical arguments, like the inability of sysadmins everywhere to update their systems because of their crappy code. When default strictures happen, we'll know that Perl is, finally, in fact dead. It would really limit obfuscation and poetry, after all. Next thing you'll be wanting us to indent blocks by a fixed amount of whitespace. It's fascist!
Re:bad idea
Aristotle on 2007-12-27T18:04:58
Really. All those sysadmins’ existing crappy scripts will magically grow a
use 5.012;
line at the top of the script. Amazing.Re:bad idea
tsee on 2007-12-27T18:09:41
Please re-read the proposal. It happens only if you explicitly ask for 5.12.0 features.
Cheers,
SteffenRe:bad idea
slanning on 2007-12-27T19:27:13
Ah.... hmmm, calling it "by default" could be a bit misleading, then. Anyway, I was exaggerating my reply.:) Re:bad idea
sigzero on 2007-12-27T18:46:01
I think it is anti-Perl as well.Re:bad idea
jhi on 2007-12-28T15:40:47
You are anti-Larry.
http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2007-12/msg00842.html