Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

(re:x5 use strict....)$a and $b should be in perlvar

by demerphq (Chancellor)
on Feb 28, 2002 at 11:24 UTC ( [id://148191]=note: print w/replies, xml ) Need Help??


in reply to Re: 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?

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?

  • Comment on (re:x5 use strict....)$a and $b should be in perlvar

Replies are listed 'Best First'.
Re: (re:x5 use strict....)$a and $b should be in perlvar
by little (Curate) on Feb 28, 2002 at 12:21 UTC
    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

        And just to give you a hard time about it:

        Why would I look under either when trying to understand the strange behaviour of $a or $b?

        There's nothing wrong with $a and $b. You can declare them with my, with local. They hold all kinds of scalar values and references. They're nice variables, get off their backs. :)

        It's not like $| (ever try putting a reference in there?), or $_ (stomp stomp stomp stomp) or even $1 (Hey! It's readonly!) .

        There's something wrong with sort. It uses these perfectly nice variables in strange and perverse ways so it's worth mentioning with sort -- let's mention it there. And there's something wrong with strict because it intentionally exempts $a and $b from stricture so that sort can get away with its perversity -- we should mention it there too.

        But otherwise it's not the fault of the variables. Quit blaming the variables! :)

        But if you want a footnote in perlvar I'm sure no-one would reject your patch, though.

        $a and $b are not Perl predefined variables. So they do not belong into perlvar :-)
        They are only of special use and meaning in a sort. So one might consider the occurance of $a and $b oustide of that as an error, but if that would raise an error you'd loose the ability to write custom sort subs.
        Regarding your notes on the perl manpages, do you think that the unix manpages are better organized?
        Well I think, if one is going to learn perl $a and $b should be noted along with the usage of strict, so one always remembers, that $a and $b will be used by a sort and so one better does not use them unless one explicitely wants to.
        Having said that I think $a and $b are noted in the right place in the right document in a good (but worth improving) documentation.

        Have a nice day
        All decision is left to your taste

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2024-04-16 10:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found