Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

That's a much better example. It seems obvious to me, but I can easily see how it might not be obvious to people who don't cringe when they read "recieved". More importantly, warnings will indeed not catch it. Of course, this means typoing the same variable in the same way more than once... so it still seems somewhat unlikely to me. But it's undeniably a possible scenerio.

I should also note that I have always been in favour of using strict in files that get used or included by other files; it was the value of using it in a regular script that I wasn't seeing.

And yes, I have worked with code that spans multiple files and ten thousand plus lines and uses global variables (though not in Perl, and I did not use globals anywhere near exclusively). The trouble I eventually ran into was not because of this, but because the version of the language and compiler that I had been using had limits on how large the program could be, and when I reached those limits I had to try to port it to the newer version, which proved difficult, and I set it on the back burner. I've also worked with Emacs lisp, which does not have lexical scoping as far as I know (in any event, it is not much used) but solves the namespace issue another way (by making variable names longer; the convention is to prefix your names with the name of your package). It is actually important in Emacs lisp that many variables be global, because you specifically want other code to be able to dynamically scope your variables and thus alter your behavior when it calls you. It is impolite to setq another package's variable in most cases (except from .emacs of course), but you let it as a matter of course. (let in lisp is like local in Perl; AFAIK there is no equivalent to my, nor is it missed.) Then there's buffer-local...

 --jonadab


In reply to Re: Use strict warnings and diagnostics or die by jonadab
in thread Use strict warnings and diagnostics or die by tachyon

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2022-12-06 13:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?