You can find most of my "Open Source" Perl software in my CPAN directory [cpan.org].
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
bad idea (Score:1)
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: (Score:1)
Really. All those sysadmins’ existing crappy scripts will magically grow a
use 5.012;line at the top of the script. Amazing.Re: (Score:1)
Cheers,
Steffen
Re: (Score:1)
Re: (Score:1)
Re: (Score:2)
http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2007-12/msg00842.html [mpe.mpg.de]
Not sure what the opposite of a flame is... (Score:1)
I'd enable warnings too
The opposite of a flame is a bucket of cold water (Score:1)
+1 from me (Score:1)
But having "use 5.012" implicitly mean "use strict;" can only be positive as far as I can see.
It upgrades one good practice (using strict) to an even better practice (always declaring minimum Perl version compatibility).