in reply to RE: RE: History of 'our'
in thread History of 'our'

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>

Replies are listed 'Best First'.
RE: RE: RE: RE: History of 'our'
by japhy (Canon) on Jul 23, 2000 at 19:24 UTC
    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
RE: RE: RE: RE: History of 'our'
by Anonymous Monk on Jul 24, 2000 at 19:28 UTC
    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.

      *blush* I've never been good with dates nor arithmatic (there have been significant stretches where I've consistantly gotten my age wrong). Its been about 10 years programming Perl and I started with Perl3.something.

      Well, honestly, I wasn't trying to brag. It isn't an accomplishment, like staying married for 10 years; I just ran into perl that long ago and have continued to use it ever since for reasons that most readers here probably understand.

      If you really want to see code from long-term Perl veterans, that is easy to find. As for my stuff, the only thing that comes to mind that is of significant length in the Perl part of the code and that is publicly available is Win32::TieRegistry.