Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Re: Re: Re: use strict won't require explicit name for all variables?

by Biker (Priest)
on Feb 28, 2002 at 10:53 UTC ( #148185=note: print w/ replies, xml ) Need Help??


in reply to Re: Re: Re: use strict won't require explicit name for all variables?
in thread use strict won't require explicit name for all variables?

<OPINION>
Problem or not problem. I consider the usage of certain variable names as 'special' variables a problem.
Will $nbr be used as a special variable one day? Or what about $i if we stick to one character names? (Wonder how many scripts would be broken by that last one.)

OK, so $a and $b were both there before me, but how am I to know? How am I to know that I need to read up on sort to know that they exist?

I admit that there are $_ and many other 'special' variables and I use them on a daily basis. But they look different and I instinctively don't use those names as my working variables. With $a and $b I have to explicitly be aware of their special behavior/existence or else devine their existence which is very far from intuitive.

But that is, of course, just an opinion. ;-)
</OPINION>


Everything will go worng!


Comment on Re: Re: Re: Re: use strict won't require explicit name for all variables?
Select or Download Code
(re:x5 use strict....)$a and $b should be in perlvar
by demerphq (Chancellor) on Feb 28, 2002 at 11:24 UTC
    Hmm. On second thought there is a problem. These variables should be listed under perlvar.

    As should $1 up. That would place all of the variables that have special meaning in one place and would reduce the possibility of this type of error. (Well assuming RTFM ;-)

    I will send a perlbug report out today on this issue. Maybe itll be factored into 5.8?

    UPDATE: DOH! $1 and the regex vars _are_ documented under perlvar. By bad.

    UPDATE: A documentation enhancement request has been sent to the perlbug people...

    Yves / DeMerphq
    --
    When to use Prototypes?

      see 'perlman strict', paragraph 'strict vars'

      Have a nice day
      All decision is left to your taste
      Update:
      QUOTE: "Because of their special use by sort(), the variables $a and $b are exempted from this check."
      End of discussion :-)
        Yeah, I know that $a and $b are documented under
        perldoc strict perldoc -f sort
        But the fact that they are mentioned there does not mean that they are properly documented. Properly documented means that when you need to find something it is in a logical place. Why would I look under either when trying to understand the strange behaviour of $a or $b? (the trouble may not be that need not be declared, it may be action at a distance) Where I would look first would be perlvar.

        Frankly actually one of my few complaints about the perl documentation set is that it is poorly organized. I have encountered numerous examples of where you need to read several different docs with apparently nothing to do with each other in order to understand the behaviour of one thing that isn't documented explicitly.

        Likewise on the nice day... ;-)

        Yves / DeMerphq
        --
        When to use Prototypes?
        Advanced Sorting - GRT - Guttman Rosler Transform

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2014-07-25 05:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (167 votes), past polls