Monday, August 17, 2009

Am I the only one NOT using "strict"?

An old friend came to town the other day. He's quite a Perl guru. Like me, he was a Perl user prior to Perl 5 and I figured he'd be someone who, like me, NEVER uses 'use strict'; in their code. I was wrong! Man, that's one of the things I like about Perl. It'll let me ride a motorcycle without a helmet. Drive without a seat belt. Go swimming in less than 30 minutes after I've eaten or even run with scissors! I know! I know! These are not good ideas - but short cuts seldom are. It's the price you pay and as long as you know the risks, it's nice that Perl lets you use a variable that has not been declared or invoke $_ with the notion that both Perl and yourself know what you're talking about (in that context). I like that freedom. I guess the other side of the coin is you're also allowed to add "use strict" and "use warnings". I'm just glad it's not the default (yet).

6 comments:

  1. It's your life you're wasting. Anything that strict doesn't let you do is something that you don't *want* to do 99.44% of the time, but is easy to do by accident. Anything that triggers a warning is 100 times more likely to be a bug than to be intentional. If you enjoy spending more time hunting down stupid bugs caused by typos than doing actual coding, then don't use strict or warnings.

    ReplyDelete
  2. I'll often go without use warnings, but even so I still use strict.

    ReplyDelete
  3. As long as you let me use strict I'm happy :-)

    ReplyDelete
  4. Personally, I like strict.

    I'm a good driver, but I still wear a seatbelt. Sure, it stops me doing really advanced things like taking off my sweater when I'm stopped at traffic lights, but I can always quickly take it off, do what I need to do, and then put it back on again.

    And as far as I'm concerned, it *is* the default. Or at least, if I say "use Moose" or "use MooseX::Declare" at the top of my script it's turned on automatically for me...

    ReplyDelete
  5. I'm with you up until your last sentence. At this point, I think we'd all be better off if you had to say "no strict" and the rest of us (especially new people) got strictures and warnings by default.

    ReplyDelete