deprecate use of reserved word "our" (Larry's idea)
authorLarry Wall <larry@wall.org>
Mon, 22 Jun 1998 08:55:09 +0000 (01:55 -0700)
committerGurusamy Sarathy <gsar@cpan.org>
Sat, 4 Jul 1998 00:33:37 +0000 (00:33 +0000)
Message-Id: <199806221555.IAA07212@wall.org>
Subject: Re: our

p4raw-id: //depot/perl@1276

pod/perldiag.pod
toke.c

index 841be54..468e0a3 100644 (file)
@@ -2747,6 +2747,15 @@ In code that currently says C<use AutoLoader; @ISA = qw(AutoLoader);> you
 should remove AutoLoader from @ISA and change C<use AutoLoader;> to
 C<use AutoLoader 'AUTOLOAD';>.
 
+=item 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 C<&> prefix, or using a package qualifier,
+e.g. C<&our()>, or C<Foo::our()>.
+
 =item Use of %s is deprecated
 
 (D) The construct indicated is no longer recommended for use, generally
diff --git a/toke.c b/toke.c
index c734fc8..5d0f8f3 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -4399,6 +4399,8 @@ keyword(register char *d, I32 len)
        case 3:
            if (strEQ(d,"ord"))                 return -KEY_ord;
            if (strEQ(d,"oct"))                 return -KEY_oct;
+           if (strEQ(d,"our")) { deprecate("reserved keyword \"our\"");
+                                               return 0;}
            break;
        case 4:
            if (strEQ(d,"open"))                return -KEY_open;