Front page | perl.perl6.language.strict |
Postings from February 2001
Re: Warnings, strict, and CPAN
February 16, 2001 23:37
Re: Warnings, strict, and CPAN
Message ID: 20010217023741.A15734@magnonel.guild.net
I think we're rapidly approaching "agree to disagree" territory here.
On Fri, Feb 16, 2001 at 09:03:54PM -0800, Edward Peschko wrote:
> Right now, I do a search on the standard distribution, and I see
> 'use warnings::register' in 13 out of 270 modules. Make 'use warnings' the
> default, and you'd bet that there would be a big push to make the standard
> distribution clean.
No, there will probably be a big push to shut it off, based on
historical reactions to this sort of thing.
If you don't think so, I urge you to submit a patch to p5p which turns
on C<use warnings> in every core module. Consider it a trial run.
I'm not disagreeing that the core libraries need shaping up (just look
at my patching record). But this is not the way to do it.
> forgetting to type 'use strict' in your script and 'use warnings' is
> a syntax error to me.
YMMV wildly. Again, I do not disagree with your opinion and hold
nearly the same myself, but you'll find fairly strong reactions
> 4. to make '-w' usable again
All right, where is this mysterious mass of low-quality code you're
working with? I stick -w on all programs by habit and I use *alot* of
CPAN code. I'm not overwhelmed with warnings.
> > Do you know how long FreeBSD distributed perl4 as /usr/bin/perl? I
> > think it was only in 1998 they switched to perl5. FOUR YEARS after
> > 5.000 came out. Why? They didn't want to break their user's
> > programs.
> that's irrelevent because of perl's 'use perl5' feature. God I love that idea.
No no no. FreeBSD's distribution might be able to audit its code and
add in C<use perl5>, but its user base cannot be expected to do so. A
distribution which includes perl will be very, very hesitant to
upgrade if that upgrade will break their user's existing code.
> You said that a large percentage of perl programmers want 'use
> strict' and 'use warnings' on by default; their voices should be
> heard by Larry. The RFC that you started should be finished, only if
> to give him the rationale on both sides of the argument.
Larry reads the mailing lists, too. He's unfortunately already
probably read these same arguements a few times already.
> THAT DOES NOT WORK. First of all, your syntax is off - the
> '-Mw..-Ms..' one will ignore the '-Mstrict' part and generate an
> error because -M can only take one argument. But more importantly,
> THIS IS NOT UNIVERSAL AND CANNOT WORK IN A UNIVERSAL SCOPE.
Hmm, its damned silly that you can't give two modules on the command
Anyhow, you don't want it to work in universal scope. I think we're
in agreement there.
> So the only thing that '-Mstrict' *can* do is force you to have strict at
> the beginning of your script.
I thought that was the problem you were having. Forgetting to type
"use strict" in your programs.
Modules? Modules should have test suites. A simple test would be to
check for /use strict/. Of course, you *are* writing test suites for
all your modules, right??
> Well, you'd have to take that sucker from machine to machine, from
> platform to platform, from box to box. Sort of like the hell I'm
> going through in taking my intelligent tcsh defaults from place to
For your own development, sure. But that's your problem. Me? I have
a laptop that I use everywhere. :P
Otherwise, your program will run just fine with strict off. It'll
also run just fine with warnings off. No distribution worries.
> > No it isn't??? I ASSURE you from many experiences, changing a program
> > from unstrict to strict is NOT a simple task and typing C<use strict>
> > is the absolute LEAST of my worries.
> Its a non-trivial thing, yes, but that's what 'use perl5' is for. So people
> have time for upgrading.
That's not the point. Your original argument was that '-q' made for a
simpler upgrade path for turning on strictness because its easier to
delete two characters than to type ten. I say its a rediculous
optimization since the process of making a non-strict program strict
is extremely non-trivial.
> Sometimes you want to just get things done. Sometimes you want to do
> what you expect and go out and help someone. That should not be the
> default. In any case, it sure as hell dilutes your quality and the
> quickness of finding YOUR bugs.
If you're using their module, their bugs ARE your bugs! If
something's throwing warnings in your program, you fix it. Whether
you wrote that part of the code or not. Perl doesn't care who
authored what part, it'll make the mistakes just the same.
I don't want to have to turn on extra flags to see all the problems in
my system. You're just trading your having to remember to turn on
C<use strict> for my having to turn on some new flag.
> > And no, -w should not override C<no warnings> else you'll have
> > legitimate cases of warning suppression being violated. (See
> > AnyLoader, Cwd, ExtUtils::MM_Unix, Fatal, etc... for examples).
> Well, '-w' really isn't needed under the new scheme so I don't see why not.
??? which new scheme?
> As for the string 'use warnings' in OR outside the perl distribution, well
> there are *no* uses. At all.
That's because warnings.pm is a 5.6.0 only thing and CPAN modules have
to work on older versions of perl. Try grepping for '\$\^W' instead.
Combining that with a search for "no warnings" brings us up to
19 .pm files (about 12% of the total number).
Checking my site_perl, I come up with 62 modules (again, about 12%)
that play with $^W.
Aside from the compatibility issues, most modules do not C<use
warnings> for the same reason people don't ship with -w on. We don't
want to give anyone trouble unless they ask for it. Which is fine.
This is not to say warnings are ignored. I run all my tests with -w.