Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Scoping (Score:2, Informative)

    I must say, I find it a pretty good article, but I disagree on the author's point of view on variable scoping in addition, he seems to have overlooked a few extremely bad traps.
    • As opposed to the author, I do like automatic limiting of the scope of variables to the sub (er, "function") they are in. By contrast to perl, everything that you use is a local variable, unless you explicitely say it isn't. I think that's a good thing.
    • OTOH, I hate it that every variable you create outside of a function, i
    • by trachtenberga (3651) on 2003.11.01 2:40 (#25360)
      The piece does a good job of showing you ways the you can shoot yourself in the foot while using PHP, but I really think many of these problem can be avoided in any professional development context. By "professional development context," I mean you are running your own machine and server and aren't on a shared host. On your own box, you have control over all the settings and can make sure all the troublesome ones are turned off, the good ones are enabled, etc. Whether PHP should allow you to use "stupid" settings is a different issue, of course, but PHP tries hard to make things easy for non-programmers and it's hard to balance these two sides. I agree the lack of consistency in function names is nothing to be proud of, but new functions are being named consistently. Again, whether it's worth it to break existing code to enforce naming standards, is a tough question. Personally, I wish PHP 5 would rename everything the "right" way and provide some backwards compatable aliases, but I doubt that'll happen. However, the array example is contrived and stupid. If you were to do something like that (and when would that be?), you'd probably just iterate over it using foreach(), so who cares what the internal order is? Perl hashes don't guarantee any order, but I don't see the sky falling down. I find that I solve the issue of namespaces by creating objects and holding all my "package" variables as instance variables. Therefore, you only end up with a few major objects floating around in the global namespace and whatever "local" variables you're using in your script.