Front page | perl.perl6.language.strict |
Postings from February 2001
Re: Warnings, strict, and CPAN
Thread Previous
|
Thread Next
From:
Edward Peschko
Date:
February 17, 2001 13:31
Subject:
Re: Warnings, strict, and CPAN
Message ID:
20010217133127.A20538@excitehome.net
> I thought that was the problem you were having. Forgetting to type
> "use strict" in your programs.
No -- its *anywhere* that you write scripts/modules/what have you. Anywhere
you miss it, it is a syntax error to me.
> 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??
Of course - ultimately I write test suites. I however don't write test suites
when I'm first iterating code and design. Why the hell would you write a test
suite when your interface is changing?
That's where it is a syntax error. And that's where there is no good solution.
> For your own development, sure. But that's your problem. Me? I have
> a laptop that I use everywhere. :P
And for almost everybody else's.
> 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
that is a straw dog. It is not what I said.
> optimization since the process of making a non-strict program strict
> is extremely non-trivial.
Look - if you are going to have a discussion with me, *please* answer all of
my points. I do this for you, you should show the same courtesy to me.
Otherwise, it is very frustrating. It is very easy to edit out points that you
don't have an answer for, and come back with an edited reply.
That's called hitting a straw-dog. You are caricaturing my position - perhaps
non-intentionally, but you are doing it nonetheless.
So go back to my original post. My argument is that it is going to be a process
of weaning people off of *not* using strict and warnings. And my point is that
people will start with '-q', and probably use it most of the time. But once in
a while, they will forget.
And when they do, they will either immediately add '-q' to their scripts and
ignore the warnings, or they will actually think about the errors that are
coming on their screens.
If they think about the errors, they will *see first hand* how warnings and
script help them. This is a lot better than having a lukewarm dictum of
'use strict' or 'use -w' thrown at them.
*please* read my entire posts and look at individual issues before responding.
Its very frustrating when you don't. If you don't agree with the above logic
tell me why. If you *do* then concede the point.
> > 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.
Right, but its a question of priority - by making warnings the default we force
ourselves to be more careful. We sure as hell can't tell people 'use -w' if we
don't believe it ourselves.
And its a question of *usability*. Look at the following piece of code:
use Carp;
my $a = undef;
carp($a);
When I run this under 'use warnings', I get the following.
Use of uninitialized value in join at /home/edwardp/install/lib/perl5/5.6.0/Carp/Heavy.pm line 164.
Use of uninitialized value in join at /home/edwardp/install/lib/perl5/5.6.0/Carp/Heavy.pm line 31.
Now what the $#%#@ is that supposed to mean? How is that going to help
beginners? Modules don't have to be '-w' clean by themselves, modules have to
be '-w *useful*'.
And this is going to involve to some extent making modules so they point
to the original source of failure, rather than point to themselves. So they
behave more like exceptions.
> 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.
You don't. Since '-w' is no longer needed in its present meaning, you can turn
on '-w' to get its new meaning.
> > > 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?
The new scheme where '-w' overrides 'no warnings'. Or perhaps 'hide warnings'
is a better term. Please read my post. If you don't understand something
tell me so and I'll try to explain it further.
> > 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).
12%. Wow. that shows how beneficial people think warnings are..
>
> Checking my site_perl, I come up with 62 modules (again, about 12%)
> that play with $^W.
It does not matter - if you came up with a term - 'hide warnings'
- that is more logical after all, and had '-w' override that term, there would
be no backwards compatibility issues.
> 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.
Make it 'hide warnings', and put that in your modules then. And run your tests
with '-w'. In any case, its a way of putting strict and '-w' to the
foreground, by default, so that we HAVE to make it useful.
In any case, I want this put in an RFC. Larry may or may not read these posts
- and it does no harm whatsoever to formalize it. I sure haven't heard the above
arguments before...
Ed
Thread Previous
|
Thread Next