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

Re: "static" declaration



   At Tue, 6 Aug 2002 09:18:33 -0400,
   Sundar Narasimhan wrote:
   > 
   > I benchmarked at one time that about 60-70% of our bugs in
   > "newly deployed" Perl code was due to this single issue. Simple typos
   > where a single character in a variable's name was transposed or
   > mistyped etc. wreak havoc.
   > 

   Have you ever considered 'use strict' and 'my $var' in Perl5?
   You can reject simple variable typos 'statically'.

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. 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.

   # In my experience, with the 'use strict' feature, I can manage
   # 3-10 times(or more) larger code, than perl4.

   Since I still write many one-liners, I love 'optional' static check!
   I always 'use strict' in my production code/modules. But in daily
   one-liners, rarely.

   ========
   KOBAYASI Hiroaki -- hkoba@t3.rim.or.jp --
   If you feel my english is strange, please correct me.