Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

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 ( [id://756612]=note: print w/replies, xml ) Need Help??


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

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.

Replies are listed 'Best First'.
Re^3: Should code that does not use strict even be considered here?
by JavaFan (Canon) on Apr 09, 2009 at 14:46 UTC
    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.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (2)
As of 2024-04-26 05:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found