David Storrs writes: > On Dec 15, 2004, at 6:11 PM, Abhijit Mahabal wrote: > > > S01 says: > > > > # Perl 5 code is not strict by default, while Perl 6 code is. But it > > should be easy to relax with -e or maybe even a bare version number: > > this would suck. Badly. > > We should not be optimizing for the compiler's convenience, but for the > programmer's.
I find strictness _is_ for the programmer's benefit! I've had to work on some scripts which were originally written by people new to Perl who didn't know about strict (or warnings); I found I was making various sorts of errors (some embarrassingly simple) that I don't normally make, because I'm used to them being caught for me automatically. The compiler doesn't care whether you use strict or not -- it'll happily compile what you've written, even if there are logical errors in there! > Although I can't prove it, I strongly suspect that the majority of > times that someone sits down to do something with Perl, it's a quick > one-liner or short script. Who knows? Perl is used in so many different ways there probably isn't a 'typical' user. And note that C<-e> is one of the things that disables strictness, so your concern about one-liners has been addressed. > Strictness just gets in the way for those. A short script tends not to use many variables, so having to type C<my> a few times isn't much of a burden; nor will it be much effort to disable strictness. I think Larry's got this one right: somebody writing a short script who's getting strictness errors can get irritated by this, and therefore looking up how to disable it; whereas the current way round, a new Perl programmer writing a large script can mistype many variable names without it ever occurring to him that something like C<strict> exists and the situation could be avoided. Smylers