Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: use strict

by afoken (Parson)
on Jan 26, 2010 at 15:46 UTC ( #819702=note: print w/ replies, xml ) Need Help??


in reply to Re: use strict
in thread use strict

Oh, and if you argue "but adding no strict; isn't that much work", then I counteract with use strict; is only one character more - so, it's not much work, is it?

Hmmm, very strange argumentation. Having strict on by default would need 12 characters less (including the final newline), and that for everyone who thinks that strict mode is a good idea, as opposed to the few people still working with Perl4.

Having strict on would break a lot (but propably not all) of ancient Perl4 code, and for a good reason: New version, new rules. If you want to run Perl4 code, use a perl4 executable. Or add no strict; or a hypothetical use perl4;. Or port the code to Perl5.

One could discuss to turn on strict mode only for "real" scripts, and not for quick command line hacks (perl -e ...).

And the same applies to the step from Perl5 to Perl6. Yes, I'm aware that a Perl5 mode for Perl6 is at least discussed, if not planned or already implemented.

And yes, I'm aware that this discussion won't change Perl5, and it's too late now to change Perl5 to have strict mode on by default. But at least we can learn this lesson for Perl6.

With the new operators for 5.10, we see a very similar problem: Backwards compatibility at every cost, even if it makes writing modern Perl harder. Modern::Perl is a pretty neat idea, but it is not a core module and it cures the symptoms, not the root cause.

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)


Comment on Re^2: use strict
Select or Download Code
Re^3: use strict
by JavaFan (Canon) on Jan 26, 2010 at 16:07 UTC
    Having strict on would break a lot (but propably not all) of ancient Perl4 code
    I doubt there's a lot of ancient perl4 code laying around. That's not the problem.

    It's the unknown quantities of code written in the last 15 years that will break if use strict; suddenly becomes the default. Note that includes oodles of code that runs without problems.

    And the amount of code will only grow.

    I'm sure you could convince p5p to make use strict; the default if you can show there's not much code out there that would break. But you don't know how much code is out there - and how it's written. Noone knows.

    And yes, I'm aware that this discussion won't change Perl5, and it's too late now to change Perl5 to have strict mode on by default. But at least we can learn this lesson for Perl6.
    Perl6 will have strict on by default. Or at least, it still had that last time I heard someone trying to get me the drink the Perl6 Kool-Aid. But who knows, it may have changed since.
    Modern::Perl is a pretty neat idea, but it is not a core module
    Wait? You don't mind if other people have to change their, currently working, code, but you find it a problem if a module that helps you write "modern" (for some value of "modern") code is a module that has to be downloaded from CPAN?

    With the new operators for 5.10, we see a very similar problem: Backwards compatibility at every cost, even if it makes writing modern Perl harder.
    Backwards compatibility is very important. And how are the "new operators" keeping you from writing "modern Perl"?

    Oh, and if you're so saffy you're writing "modern Perl", you'll be able to write an editor macro that puts "use strict;" in your files for you? I've no clue how to write "modern Perl", or even what it is, but I haven't had a need to type use strict; to get strictness for a long, long time. Two keystrokes, and it says "#!/usr/bin/perl\nuse strict;\nuse warnings;\n". A slight variations, and it does the same with a package statement instead of a she-bang line. I really do not buy the argument "my fingers are wearing out typing 'use strict'".

      It's the unknown quantities of code written in the last 15 years that will break if use strict; suddenly becomes the default. Note that includes oodles of code that runs without problems.
      The probably most widespread example for this breed is the CGI module.


      holli

      You can lead your users to water, but alas, you cannot drown them.
        Stepping aside the issue of backwards compatability, even if 5.xx is going to enable a "wall of pragmas" by default, who's going to decide which set of pragmas that will be?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2014-07-13 14:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (250 votes), past polls