New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use strict 'vars' #1028
Comments
From ccadieux@ccadieux.Central.Sun.COM[Please enter your report here] #/usr/bin/perl $a = 2; # this code should not work but does. Site configuration information for perl 5.003: Configured by eric at Mon Sep 16 15:29:50 PDT 1996. Summary of my perl5 (5.0 patchlevel 3 subversion 0) configuration: |
From @tamiasOn Tue, Jan 11, 2000 at 01:08:20PM -0700, Christian Cadieux wrote:
$a and $b are special-cased because they are used by sort subroutines. Ronald |
From [Unknown Contact. See original ticket]
% man strict use strict 'vars'; package Cinna; The local() generated a compile-time error because you just ----> Because of their special use by sort(), the variables $a and Perhaps they should be listen in perlvar as well. I notice @F is I further note that `man strict' doesn't mention Larry's spiffy new --tom |
From @TimToadyTom Christiansen writes: Perhaps perlbug should refuse to post a report containing the words : I further note that `man strict' doesn't mention Larry's spiffy new Yup. I missed that one. Larry |
From [Unknown Contact. See original ticket]Ronald J Kimball wrote:
<rant> but from a user point of view, its a hidden gotcha. could perl spit out some kind of note when it encounters $a or $b would it be too much to rename it to something less likely to if there isn't much of a performance/memory/etc hit, could I don't like global variables to begin with. sorry, doing test vectors today, and just in a generally bad mood. ;( Greg |
From [Unknown Contact. See original ticket]
Was that a question?
I fail to see how something that it is documented can be adjudged
Perhaps this is a special penalty for those with insufficient
Goodness, I don't think so.
Only if breaking it in that odious fashion should cause Perl to emit First of all, there's no reason to shamelessly destroy all existing sort for ($loop_index_variable = 0;
Sure, as long as you agree that Perl should in perpetuity emit your real
Then perhaps you shouldn't use them. Deal? :-) --tom |
From @TimToadylondon@pixelmagic.com writes: Speed and notational convenience. In a very recent development version of Perl, if you use a sort sub Larry |
From [Unknown Contact. See original ticket]you can be quite hubritic sometimes, really. I start out by saying "I'm sure there was a reason it was done this way" your response it to reject the idea out of hand, given that any language is useless if there aren't any people using You are a veritable wealth of knowledge on the subject of perl and if anyone asks an honest perl question and you reply with sarcasm, specific responses below: Tom Christiansen wrote:
people expect computer languages to all behave pretty much the same.
could not the same penalty be applied to Perl for using
we can put a man on the moon, but we can't do this ....
figure out the number of sorting subroutines that exist in perl
that rant alone should fully exceed the number of characters needed to expand
is that such a foolish suggestion? Larry Wall wrote:
it looks like @_ would get rid of the globals and everyone would be happy. Greg "Waiter, a round of diligence, patience, and humility |
From [Unknown Contact. See original ticket]From the number of cheap shots TomC has been making recently, I'd say <strawman> Warn on uses at the toplevel scope (or scopes without a Maybe that's totally insane, I don't know. Given that this "bug" report arises so frequently, why was I unable to http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/1999-12/msg00009.html There is a mention in perlfunc, but judging from the number of reports, |
From [Unknown Contact. See original ticket]Sigh. Do I really have to answer all this? It is completely End of story. --tom |
From [Unknown Contact. See original ticket]Tom Christiansen wrote:
Don't break anything, but possibly produce incorrect warnings. If new Correct me if I'm wrong, but I thought the oft-repeated bug report is Or not, if you're no longer reading my sentences that aren't too many |
From [Unknown Contact. See original ticket]
If you suddenly produce a warning just because someone was using If you dont' believe me, try it. Here's an "I told you so" in
"use strict" doesn't "work" for a lot of other variables, either, The novice issue is a red herring, and the "all programs do work (or should
I do believe I suggested a documentation patch. Finally, the notion that "using single-letter variable names is a You can't "outlaw globals". That's not what use strict does, you know. --tom |
From [Unknown Contact. See original ticket]Steve Fink (lists.p5p):
Well, it does, in the documentation of strict.pm, if you read the I regard this as having fixed the problem, when changes in the strict.pm Maybe you think providing accurate documentation isn't enough, and we -- |
From [Unknown Contact. See original ticket]Tom Christiansen wrote:
I think its interesting that most of perl's globals look like hieroglyphs. such names have near zero chance that a neophyte would accidently stumble onto them. what about changing the global to some form of hieroglyph? then spit out a warning saying $a $b has been deprecated,
for every exception added to perl, the more un-usable perl becomes. it's generally said that perl tries to "do the right thing" a bad decision was made to use $a and $b as global sort variables. I'd guess there are 20 *.pm files in the perl distribution why the outrage? Greg |
From [Unknown Contact. See original ticket]You forgot a lot of other globals, like $STDIN and %ARGV.
If we want to rewrite Perl, fine. Failing that, not fine.
Those twenty files are irrelevant. You cannot expect to
Because it is arrogant to make these high-and-mighty decisions I have a much better idea: go learn what $a and $b are for in sort THOU SHALT NOT SCREW WITH EXISTING CODE. --tom |
From [Unknown Contact. See original ticket]Tom Christiansen wrote:
and that would that be *your* puritanical maxim then? I never claimed to have the answer, I only asked why it was but if the weight of backward compatibility is infinite, Greg |
From [Unknown Contact. See original ticket]
Your skill at detecting irony is, I note, only halfway developed.
There's a big difference between "couldn't be done" and "couldn't And don't be surprised if replies contain the same tone as the Hope this helps, -tom |
From [Unknown Contact. See original ticket]On Thu, Jan 13, 2000 at 02:49:55PM -0500, "london@pixelmagic.com" wrote:
I think Tom would be perfectly happy with 5.004 living forever. :-) mark P.S. For a few projects, I am currently _ON PURPOSE_ using perl5.004. I -- One ring to rule them all, one ring to find them, one ring to bring them all http://mark.mielke.cc/ |
From [Unknown Contact. See original ticket]Ronald J Kimball wrote:
point taken. my apologies to everyone on the list for any emails that got out of line. Greg |
From @TimToadylondon@pixelmagic.com writes: I like $a and $b. It's just that lexicals hadn't been invented yet, Larry |
From [Unknown Contact. See original ticket]Tom Christiansen wrote:
Hm. TomC, you seem to be responding to my suggestions as if they were Yes, I am proposing issuing a warning just because someone was using $a
I was assuming the implementation of the above proposal, and the message
Much of the example code in the documentation uses $a, $b, and $c. my $a, $b; # oops! Forbidding $a and $b in general and in these kinds of situations in |
From [Unknown Contact. See original ticket]Generic examples that use $a and $b should perhaps use $x and $y instead. --tom |
From @TimToadyTom Christiansen writes: Over the long haul, this will not be an issue, since explicit sort At that point we could deprecate unprototyped sort subs if we want to. Once all the unprototyped sort subs are gone, we can make "use strict vars" Larry |
From @TimToadyMark Mielke writes: You'll note that every version of Perl from version 1 through version 4 So people who are worried about Perl breaking should be writing more And before anyone submits a patch for it, I'm not talking about testing Larry |
From [Unknown Contact. See original ticket]On Thu, Jan 13, 2000 at 01:16:29PM -0800, "Larry Wall" wrote:
That's not what I saw when people were recommending perl5.005_53 over Sorry... perl5.004 with the maintenance patches is perfect for the rock For everything else I use the latest and greatest that I happen to have I didn't mean that to come across quite as negative as perhaps it did. I Personally, I think language evolution is necessary, else extinction mark -- One ring to rule them all, one ring to find them, one ring to bring them all http://mark.mielke.cc/ |
From @RandalSchwartz
Larry> You'll note that every version of Perl from version 1 through Larry> So people who are worried about Perl breaking should be writing more Just weighing in: 1) Let's not break @a = 2) If exists() can detect some change in state in a pseudo-hash, then 3) There is nothing for item 3. :) -- |
From @RandalSchwartz
Randal> 1) Let's not break @a = Well, except to get the math right. @a = Bleh. One of those lifetimes. :) -- |
Migrated from rt.perl.org#1979 (status was 'resolved')
Searchable as RT1979$
The text was updated successfully, but these errors were encountered: