Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^3: Why isn't C<use strict> the default?

by Aristotle (Chancellor)
on Oct 29, 2004 at 12:39 UTC ( [id://403715]=note: print w/replies, xml ) Need Help??


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

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.

Replies are listed 'Best First'.
Re^4: Why isn't C<use strict> the default?
by BrowserUk (Patriarch) on Oct 29, 2004 at 13:07 UTC

    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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://403715]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2024-04-19 21:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found