[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "static" declaration




At Tue, 6 Aug 2002 11:26:21 -0400,
Sundar Narasimhan wrote:
> 
> Yes. But I think that with large codebases you don't want to
> necessarily start w/ this, because then you'd be wasting your
> afternoon fixing "other" things.

Hmm, this depends on what "large codebases" points, doesn't it? 

I largely rely on CPAN, and I'm very happy starting my perl module
with "use strict", for about 8 years. (Note: "use strict" is
"lexically scoped", so doesn't affect to included modules.) In many
cases, CPAN modules "use strict", so you can trust them. See this
(sorry, this is a Zsh session):

  % pm=(/usr/lib/perl5/**/*.pm)
  % echo total=$#pm
  total=609
  % pm_strict=($(grep -l "use strict" $pm))
  % echo with_strict=$#pm_strict
  with_strict=404
  % ((x = $#pm_strict * 100.0 / $#pm)); echo $x
  66.3382594417
  %

# This only counts what I installed, not whole CPAN though.

Of course, out of CPAN, there are many immature perl codes which lack
"use strict".  If I unfortunately come to need using such a code, I
first try to rewrite it into "use strict" clean.  If it is hard, then
I totally rewrite it from scratch (in better OO-design, IMHO;-). Yes,
it takes fair amount of time, but saves my future.

>  For example, most programmers here
> quickly learn that turning on "NullPointerException" is a good thing
> (we use VisualAge which is a useful IDE -- because in contrast to
> try/catch -- it can actually 'break' at the moment the exception is
> thrown -- so that you have your stack available for examination), but
> do it before your app is started, and you'll be cursing at the bad
> design at the internals of the URL, Thread or TimeZone class (all of
> these throw NullPointers in various versions of the JDK) and possibly
> wasting your time to figure it out / fix it.
> 

Sorry, I'm confused... Because I have never used VisualAge, I don't
know the maturity of Perl support in VisualAge. What are perl's
corresponding classes of those you mentioned (URL, Thread, TimeZone)?
How JDK cooperates with your perl scripts?
And, what is your real problem/issue?

 (1) IDE (VisualAge)'s weak support for Perl.
 (2) Poorly designed codebases you encounterd.
 (3) Perl's weakness of static checking.

If (1), bypassing IDE might help you. Perl's builtin debugger (perldb:
perl -d YOURSCRIPT) is not visually rich, but you can address your
problem more directly. See: http://www.codebits.com/p5be/ch16.cfm

========
KOBAYASI Hiroaki -- hkoba@t3.rim.or.jp --
If you feel my english is strange, please correct me.
(Note: I use&love Perl, Zsh, lisp, prolog, GNU make, tcl/expect and
C++. I use&love building my own DSL for the case of large projects
(eg. Network game server). I also use&love Hoare logic with unit test
in really hard cases (eg. linux's device driver, ...). I have never
used ML & Haskell in real life, but I learned type-inference &
referential-transparency helps coding a lot.)