Closed p5pRT closed 20 years ago
My suggestion: I'd like to be able to turn on a warning that lets me know if my program contains function calls to functions that I haven't defined. So for example:
my $a1 = foo1(); if ($a1 == 3) { $a1 = foo2(); } print "a1 is $a1\n";
sub foo1 { return 2; }
should report "foo2() not defined" when given the appropriate options. (This is a lot like the sort of reporting you get from the linker when you use Boring Old-Fashioned Languages.)
I appreciate that there is an overhead here\, so you'd not want this to be the default behaviour. But I think it's trivial to implement (right? Just walk the parse-tree before starting the run). It would help to ensure that programs that work today don't stop working tomorrow when someone feeds them input that wanders off down a different code-path.
Thanks for listening\,
Mike Taylor TECC Ltd. mike@tecc.co.uk Tel. +44 181 880 4040
(Oh\, and thanks for Perl -- loving it!)
At 03:21 PM 11/19/99 +0000\, Mike Taylor wrote:
Apologies for sending this to what I suspect is an inappropriate address\, but would you mind forwarding it for me please? (And what's the \suggestion\-box@​perl\.org address?)
My suggestion: I'd like to be able to turn on a warning that lets me know if my program contains function calls to functions that I haven't defined.
Except this will kill:
1) AUTOLOADed things 2) A goodly chunk of the perl core modules that have platform-specific function calls in code protected by "if ($^O eq 'whatever')" 3) Code that requires things 4) Code written by folks getting altogether too clever with symbol tables
Nothing insurmountable\, though fixing #2 would take some work. (Presumably people affected by 1\, 3\, or 4 just Won't Do That)
Dan
----------------------------------------"it's like this"------------------- Dan Sugalski even samurai dan@sidhe.org have teddy bears and even teddy bears get drunk
Date: Fri\, 19 Nov 1999 10:35:30 -0500 From: Dan Sugalski \dan@​sidhe\.org
My suggestion: I'd like to be able to turn on a warning that lets me know if my program contains function calls to functions that I haven't defined.
Except this will kill:
1) AUTOLOADed things
Uuuh ...
2) A goodly chunk of the perl core modules that have platform-specific function calls in code protected by "if ($^O eq 'whatever')"
Erm ...
3) Code that requires things
Duh!
4) Code written by folks getting altogether too clever with symbol tables
Ahem.
But otherwise\, it's great idea\, right? :-)
Nothing insurmountable\, though fixing #2 would take some work. (Presumably people affected by 1\, 3\, or 4 just Won't Do That)
Hmm\, I can't see it. Never mind\, and thanks for the ultra-prompt reply! (BTW.\, was perlbug a reasonable address to send this to?)
Mike Taylor TECC Ltd. mike@tecc.co.uk Tel. +44 181 880 4040
But otherwise\, it's great idea\, right? :-)
Yes\, actually.
Hmm\, I can't see it. Never mind\, and thanks for the ultra-prompt reply! (BTW.\, was perlbug a reasonable address to send this to?)
No\, you have a good point. It's exceedingly annoying to have a program die halfway through due to a seldom traversed codepath that includes a call to the lenght() function. Some pragma could be arranged to help this.
no autoload; or use warnings 'undefuncalls';
or some such.
That doesn't solve the issue for method calls\, and it is compile-time only warnings. I'm not sure whether this should be foisted off into B::Lint as it is now. Did you know about that? This:
perl -MO=Lint\,-context\,-undefined-subs myperlprogram
might make you happy. Then again\, that's hardly a user-friendly front end. What ever happened to the idea of a plint program that did the icky work for you\, akin to perlcc?
--tom
At 03:56 PM 11/19/99 +0000\, Mike Taylor wrote:
But otherwise\, it's great idea\, right? :-)
Yep. Heck\, I'd love to have it at times too. None of the problems are insurmountable\, just a touch tricky.
Dan
----------------------------------------"it's like this"------------------- Dan Sugalski even samurai dan@sidhe.org have teddy bears and even teddy bears get drunk
Date: Fri\, 19 Nov 1999 09:01:41 -0700 From: Tom Christiansen \tchrist@​jhereg\.perl\.com
But otherwise\, it's great idea\, right? :-)
Yes\, actually.
Oh\, thanks :-)
I'm not sure whether this should be foisted off into B::Lint as it is now. Did you know about that? This:
perl \-MO=Lint\,\-context\,\-undefined\-subs myperlprogram
might make you happy.
Ah\, no I didn't know about that -- many thanks\, I'll check it out.
But does it make me happy? Not necessarily\, since the scripts where I
most want to be able to do this sort of static checking are CGI
scripts running on IIS/NT \
Then again\, that's hardly a user-friendly front end. What ever happened to the idea of a plint program that did the icky work for you\, akin to perlcc?
No idea\, I've only been writing Perl since July!
Mike Taylor TECC Ltd. mike@tecc.co.uk Tel. +44 181 880 4040
Dan Sugalski writes:
At 03:56 PM 11/19/99 +0000\, Mike Taylor wrote:
But otherwise\, it's great idea\, right? :-)
Yep. Heck\, I'd love to have it at times too. None of the problems are insurmountable\, just a touch tricky.
Since it would be lexical\, it will not be even as bad as that. You try it once\, then you switch it off. ;-)
Ilya
Migrated from rt.perl.org#1808 (status was 'resolved')
Searchable as RT1808$