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

Re: [MacPerl] Off-topic: Use of the 'strict' pragma



In response to your questions, to wit:

\Q

1. Am I correct in assuming that the larger the project, the more likely
strict is used? Or, in the real world do some programmers just ignore it? 
2. Is strict, too strict? (This is hinted at, but I value your comments.) 
3. Once development is complete, can you save some (loading|run)time by
commenting out strict?
4. Should one 'use strict;' encompassing 'vars',
refs', and 'subs'? When should a programmer get specific?
5. Is there anything else one should know about the strict pragma? 

\E

Chris Nandor basically already said what I would have, but I figured
comments from another source can't hurt.

Your Q2 ties in with Q4. 'use strict' is indeed too strict at times, but
you address it by selectively using 'no strict' of whatever type you need.

There's more positive control. You turn it off when you know why you're
doing it. A good example is when you're using symbolic references. Just
for the code that uses those, you turn off strict refs. Rest of the time,
strict is saving your bacon.

I'm not the best typist in the world, and I find that with Perl, over half
my typos are legal code. :-) So I'll use -w and 'use strict' until the
cows come home.

The good thing about it, too, is it makes you think about scoping. You
start pre-declaring things with 'use vars' and 'use subs'. You start
thinking more about initializations. You start declaring variables in
fewer places, so it's easier to keep track of them.

And to answer your Q1, not enough programmers use strict. If _you_ do,
you're already a leg up on a lot of coders.

Arved



===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org