in reply to Should code that does not use strict even be considered here?

Sillyness. I often downvote notes because all the poster has to say is "use strict" and/or "use warning" while adding strict and/or warnings would not have helped the OP to solve his or her problem.

By all means, if code is posted which has a problem that reveals itself if strict or warnings had been used, point this out. But if a problem has nothing to do with strict and/or warning on, whining about it is just pointless clutter.

If you don't want to help someone if (s)he doesn't use strict or warnings, fine. Just keep quiet and read the next post. But it is as silly as someone not giving directions for not wearing a seat belt.

People should post code snippits. Long enough to identify the problem, but seldomly entire files. Unless it's relevant for the problem, don't post the code. Which, in most of the cases, means, don't post your 'use strict' or 'use warnings' lines. They won't matter.

  • Comment on Re: Should code that does not use strict even be considered here?

Replies are listed 'Best First'.
Re^2: Should code that does not use strict even be considered here?
by Eimi Metamorphoumai (Deacon) on Apr 09, 2009 at 14:27 UTC
    While I agree with most of your points, I do think many people fail by over-snippetizing code they post. In many, many cases I've seen, the part of code with an actual error is in the part that gets cut. I think a really good principle is to paste some stripped down version of the code (complete with enough variable definitions and data) that can actually be run by itself and produces the non-desired output. Often the mere act of composing such code answers the question, and if it doesn't, it greatly clarifies where the problem is.

    That said, I agree that if "use strict;" and/or "use warnings;" doesn't affect the code one way or the other, it might be worthwhile to mention it as a guideline, but the absence shouldn't stop anyone from helping with the real problem.

      That said, I agree that if "use strict;" and/or "use warnings;" doesn't affect the code one way or the other, it might be worthwhile to mention it as a guideline,
      Why? There millions of "good advices" one could give, but giving it to people without having any idea whether they already know that is irritating. If you ask the way to someone, and his response is "wear your seatbelts", are you happy for the good advice given? You probably already know it, it doesn't help you at all the solve your current problem, and the one who can give you directions moves on, thinking you already got help.

      Leave the uttering of irrelevant good advices to ones mother.

      And don't forget to wear a coat outside, or you'll catch a cold! (I expect many ++'s for this good advice).

        If I ask directions from someone, and get the right answer, and I'm not wearing a seatbelt, I don't mind being told also "By the way, the cops around here are really strict about seatbelts; you might want to buckle up before you get a ticket".

        Similarly, if I see code that declares all of its variables, I probably won't mention anything. But if it's obvious that adding "strict" reveals undeclared variables or other problems, it seems worthwhile to point it out, particularly if the user seems new or not particularly knowledgeable. If they know they can ignore it; otherwise, they'll learn eventually, and probably the hard way.

        And thanks, I'd forgotten to check the weather before I left, and it is a bit chilly.