http://qs1969.pair.com?node_id=738110


in reply to the "our" declaration ?!!

"our" is pointless. There is nothing you can do with it that can't be trivially done without it. The only thing it gives you is incompatibility with older perls. I recommend not using it.

Replies are listed 'Best First'.
Re^2: the "our" declaration ?!!
by massa (Hermit) on Jan 22, 2009 at 11:43 UTC
    Don't you think that, by this reasoning, all perl development should have stopped at 5.6 or something?
    I think our, combined with use strict and without use vars or qualified variables is a very elegant way of declaring package variables while at the same time maintaining minium scope for them. I suppose we will have to agree in disagreeing, and that TIMTOWTDI.
    []s, HTH, Massa (κς,πμ,πλ)
Re^2: the "our" declaration ?!!
by hobbs (Monk) on Jan 23, 2009 at 09:51 UTC
    I recommend instead not using any perl old enough to lack "our". It's a much better proposition in terms of programmer usefulness. Actually I think that (proper) Unicode support and PerlIO are enough reason that most people should never consider using anything less than 5.8. "our" is lovely when dealing with package globals and "use vars" is nothing more than a mistake.

      Proper Unicode support certainly would be a good reason to not use any earlier version. Unfortunately, perl doesn't have it yet. Unicode needs to "just work" for it to have proper support. It doesn't, as is obvious from a great many posts in this august forum. This isn't entirely perl's fault, of course, as it depends on broken libraries, broken terminals, broken filesystems, broken web browsers (for many use cases), and so on if funny furrin characters are to Just Work. It will be a very long time before Unicode Just Works, because *everything* needs upgrading. So Unicode is a bit of a red herring.

      I see only one thing in the various perldeltas which would persuade me that upgrading a working perl 5.6.2 (and re-testing everything, re-installing all my modules etc) to any subsequent version on any of my machines would be worth it. That one thing is userelocateableinc in 5.10, which is useful on one machine. The only other reasons I run higher versions of perl are:

      • Specifically for testing purposes;
      • Because that's what came with the OS;
      • Because it's easier to download the source for $latest from search.cpan.org;
      • Because someone whose code I depend on used a new feature when he didn't need to, and I'm too lazy to backport his code
      "use vars" is nothing more than a mistake.
      Then perl is a mistake. I think you wish to reconsider.