In 5.6.0, the 'our' keyword is synonymous with 'use vars' to declare package globals.
Uh, no. Not quite. It's use vars but with lexical scoping, so if it's inside a block, it loses effect after the block.
-- Randal L. Schwartz, Perl hacker
| [reply] [d/l] |
No, saying "use of reserved word XXX is deprecated" is a
very proper message; you're using a bareword, and Perl is
letting you know you shouldn't, since it's reserved for a
future use. Perl didn't say "use of XXX is deprecated."
$_="goto+F.print+chop;\n=yhpaj";F1:eval | [reply] |
Okay, I consider myself a fairly advanced Perl programmer
(after over a dozen years of it), but I find that distinction pretty danged subtle. I'd say the message "use of reserved word XXX is deprecated" is very poorly worded. It very much sounds like "use of XXX is deprecated, and, by the way, it is a reserved word".
The existence of perldiag.pod helps relieve this problem (it says "Future versions of perl may use it as a keyword..." for this message).
But it is still terrible because the meaning of "reserved word" in C (the only other place I've heard that term) is "a word reserved for use by the language", that is "if", "else", "goto", etc. So a "reserved word" in C is the same as a "keyword" in Perl.
It is strange that Perl, a language that takes much from C, to use C's phrase for "keyword" as Perl's phrase for "not yet a keyword".
In fact, I just did some checking of my facts, and I found the use of the term "reserved word" for what Perl calls "keyword" in several places other than C. In fact, Perl uses the term "reserved word" to include current keywords (see perldata.pod) so to say "'our' is a reserved word" doesn't even tell you that "our" isn't currently a keyword.
A much better error message would be "The bareword XXX may become a Perl keyword, please quote it". *sigh*, now I have a moral obligation to submit a patch. :)
OK. </rant>
| [reply] |
This is what perldiag has to say:
Unquoted string "%s" may clash with future reserved word
(W) You used a bareword that might someday be claimed as a
reserved word. It's best to put such a word in quotes, or
capitalize it somehow, or insert an underbar into it. You
might also declare it as a subroutine.
Use of reserved word "%s" is deprecated
(D) The indicated bareword is a reserved word. Future
versions of perl may use it as a keyword, so you're better
off either explicitly quoting the word in a manner
appropriate for its context of use, or using a different
name altogether. The warning can be suppressed for
subroutine names by either adding a & prefix, or using a
package qualifier, e.g. &our(), or Foo::our().
I sense a distinction between 'keyword' and 'reserved word'.
All keywords are reserved words, but not all reserved words
are keywords (yet).
I personally never found this confusing, but if you feel
morally opposed to it, send a patch on over to P5P. :)
$_="goto+F.print+chop;\n=yhpaj";F1:eval
| [reply] |
after over a dozen years of it
Perl 1 was introduced in Dec of 87, so has only been been around a little over a dozen years. You mean you have been around since pre Perl 1? Since you are bragging on how long you have been doing Perl, I assume you have some cool Perl of yours to look at somewhere. I would be interested in seeing some high caliber Perl done by a veteran of over 12 years of doing Perl.
| [reply] |