in reply to Re: Why isn't C<use strict> the default?
in thread Why isn't C<use strict> the default?

Thankyou. Nice counter argument.

All the various similes and analogies limp equally.

I think that my 'sport mode' analogy is very accurate. The only people against the idea are those wizards who see it as training wheels, and the typing of (say) -z on the shebang line an imposition. For most of them it would be typed once into their emacs template or equivalent. A one-time, two keystroke effort.

Instead, another two generations of newbies have to (un)learn the hard way.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail
"Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon

Replies are listed 'Best First'.
Re^3: Why isn't C<use strict> the default?
by Aristotle (Chancellor) on Oct 29, 2004 at 12:39 UTC

    Yes, your "sports mode" analogy certainly is much less faulty than some others, but that doesn't make it very precise. It cannot convey one-liner vs application, and it shears completely once you start considering that you can very well use modules written to run under strictures in one-liners (LWP::Simple, anyone?), and ever more so since such a module might itself be using other modules that are not written to run under strictures… But it wasn't my aim to dispute each metaphor individually.

    Social issue or not, all those posts that say: "I've tried to enable strict and warnings, but it is just so hard" testify that unlearning bad habits is always harder than learning good ones.

    I never claimed otherwise. I did say that the overwhelming majority of the teaching material available, whether that be for those who learn by example of for those who learn by lesson, teaches bad habits. Defaultifying strictures will not change that.

    Even if use strict; was to be the default from now on, most novices will still end up having to unlearn bad habits, because we have a huge legacy of bad habits in the wider Perl culture. Some of it is even built right into Perl — just look at all the globals that control I/O behaviour. This can't all just change overnight.

    I understand your concern and I certainly do wish we could teach everyone good practice right off the bat, so they would make both their own and our lives easier. But to think that just enabling strictures by default is all that this will take is vastly oversimplifying the matter. And that legacy gives us an unfortunate and unwelcome but nevertheless very real reason not to default to strictures.

    Sometimes, reality just bites.

    Here's hoping that the community's rewrite of the community will improve matters.

    Makeshifts last the longest.

      As I said elsewhere, but originally noted by demerphq, -e would be exempt. I don't follow you with regard to modules. As far as I am concerned, the only package that would be affected is main. People who right modules are well able to decide whether the code inside requires stric or not.

      Which funnily enough is exactly the reverse of the proposal for P6--which confuses the beggebers(sp? (I don't care:)) out of me. :?

      It's the guy writing his first few perl scripts that you want to catch.

      As for the those modifying scripts downloaded from the web, if the code screamed a stream of "It's broken" at them, they would probably either scream back at the author or decide that it was a crap download and look elsewhere. Who knows, it might even improve a few notorious artifacts.

      I agree about the inherent global nature of much of the internals, but these are much less of a problem than users setting out writing code that uses globals to pass data between subroutines, symbolic references and a mess of similar constructs that are a pain to undo once a tentatively working script needs to grow with the expectations and aspirations.

      Anyway, this has all got really rather deeper than I ever intended when I first posted my late night "I wonder why that is?" question.


      Examine what is said, not who speaks.
      "Efficiency is intelligent laziness." -David Dunham
      "Think for yourself!" - Abigail
      "Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon
Re^3: Why isn't C<use strict> the default?
by Anonymous Monk on Oct 29, 2004 at 10:44 UTC
    Let me get one thing straight: I think using strict and warnings is a good idea. There's no discussion about that. I just don't think my believes should be trusted upon others by making it the default. I also think it's a good idea to eat two pieces of fruit a day, and to not drink coffee. That doesn't mean I think in offices coffee machines should be replaced with fruit baskets, and those who want coffee should fetch it in the basement.

    I also agree that for a lot of programmers, whether they are newbies or more seasoned, more BDSM in the language would be a good benefit for them. Not just "use strict", but also a strong type system and a far more rigid syntax. It'll improve the quality of many programmers programs. But you shouldn't do that by changing the language - the programmers who need more structure need to change language.