From: Rafael Garcia-Suarez Date: Fri, 7 Sep 2007 09:25:24 +0000 (+0000) Subject: Remove the 'err' keyword X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f23102e2d635682f5818275abd91b9deefde470e;p=p5sagit%2Fp5-mst-13.2.git Remove the 'err' keyword p4raw-id: //depot/perl@31812 --- diff --git a/MANIFEST b/MANIFEST index 5350e35..7d51b15 100644 --- a/MANIFEST +++ b/MANIFEST @@ -3460,7 +3460,6 @@ t/lib/dprof/test8_t Perl code profiler tests t/lib/dprof/test8_v Perl code profiler tests t/lib/dprof/V.pm Perl code profiler tests t/lib/Dummy.pm Module for testing base.pm -t/lib/feature/err Tests for enabling/disabling err feature t/lib/feature/implicit Tests for implicit loading of feature.pm t/lib/feature/nonesuch Tests for enabling/disabling nonexistent feature t/lib/feature/say Tests for enabling/disabling say feature diff --git a/embed.h b/embed.h index 3bf7e69..029d29d 100644 --- a/embed.h +++ b/embed.h @@ -2175,6 +2175,7 @@ #define pp_not Perl_pp_not #define pp_null Perl_pp_null #define pp_oct Perl_pp_oct +#define pp_once Perl_pp_once #define pp_open Perl_pp_open #define pp_open_dir Perl_pp_open_dir #define pp_or Perl_pp_or @@ -4470,6 +4471,7 @@ #define pp_not() Perl_pp_not(aTHX) #define pp_null() Perl_pp_null(aTHX) #define pp_oct() Perl_pp_oct(aTHX) +#define pp_once() Perl_pp_once(aTHX) #define pp_open() Perl_pp_open(aTHX) #define pp_open_dir() Perl_pp_open_dir(aTHX) #define pp_or() Perl_pp_or(aTHX) diff --git a/keywords.h b/keywords.h index ca3a612..b2e996d 100644 --- a/keywords.h +++ b/keywords.h @@ -69,202 +69,201 @@ #define KEY_endservent 54 #define KEY_eof 55 #define KEY_eq 56 -#define KEY_err 57 -#define KEY_eval 58 -#define KEY_exec 59 -#define KEY_exists 60 -#define KEY_exit 61 -#define KEY_exp 62 -#define KEY_fcntl 63 -#define KEY_fileno 64 -#define KEY_flock 65 -#define KEY_for 66 -#define KEY_foreach 67 -#define KEY_fork 68 -#define KEY_format 69 -#define KEY_formline 70 -#define KEY_ge 71 -#define KEY_getc 72 -#define KEY_getgrent 73 -#define KEY_getgrgid 74 -#define KEY_getgrnam 75 -#define KEY_gethostbyaddr 76 -#define KEY_gethostbyname 77 -#define KEY_gethostent 78 -#define KEY_getlogin 79 -#define KEY_getnetbyaddr 80 -#define KEY_getnetbyname 81 -#define KEY_getnetent 82 -#define KEY_getpeername 83 -#define KEY_getpgrp 84 -#define KEY_getppid 85 -#define KEY_getpriority 86 -#define KEY_getprotobyname 87 -#define KEY_getprotobynumber 88 -#define KEY_getprotoent 89 -#define KEY_getpwent 90 -#define KEY_getpwnam 91 -#define KEY_getpwuid 92 -#define KEY_getservbyname 93 -#define KEY_getservbyport 94 -#define KEY_getservent 95 -#define KEY_getsockname 96 -#define KEY_getsockopt 97 -#define KEY_given 98 -#define KEY_glob 99 -#define KEY_gmtime 100 -#define KEY_goto 101 -#define KEY_grep 102 -#define KEY_gt 103 -#define KEY_hex 104 -#define KEY_if 105 -#define KEY_index 106 -#define KEY_int 107 -#define KEY_ioctl 108 -#define KEY_join 109 -#define KEY_keys 110 -#define KEY_kill 111 -#define KEY_last 112 -#define KEY_lc 113 -#define KEY_lcfirst 114 -#define KEY_le 115 -#define KEY_length 116 -#define KEY_link 117 -#define KEY_listen 118 -#define KEY_local 119 -#define KEY_localtime 120 -#define KEY_lock 121 -#define KEY_log 122 -#define KEY_lstat 123 -#define KEY_lt 124 -#define KEY_m 125 -#define KEY_map 126 -#define KEY_mkdir 127 -#define KEY_msgctl 128 -#define KEY_msgget 129 -#define KEY_msgrcv 130 -#define KEY_msgsnd 131 -#define KEY_my 132 -#define KEY_ne 133 -#define KEY_next 134 -#define KEY_no 135 -#define KEY_not 136 -#define KEY_oct 137 -#define KEY_open 138 -#define KEY_opendir 139 -#define KEY_or 140 -#define KEY_ord 141 -#define KEY_our 142 -#define KEY_pack 143 -#define KEY_package 144 -#define KEY_pipe 145 -#define KEY_pop 146 -#define KEY_pos 147 -#define KEY_print 148 -#define KEY_printf 149 -#define KEY_prototype 150 -#define KEY_push 151 -#define KEY_q 152 -#define KEY_qq 153 -#define KEY_qr 154 -#define KEY_quotemeta 155 -#define KEY_qw 156 -#define KEY_qx 157 -#define KEY_rand 158 -#define KEY_read 159 -#define KEY_readdir 160 -#define KEY_readline 161 -#define KEY_readlink 162 -#define KEY_readpipe 163 -#define KEY_recv 164 -#define KEY_redo 165 -#define KEY_ref 166 -#define KEY_rename 167 -#define KEY_require 168 -#define KEY_reset 169 -#define KEY_return 170 -#define KEY_reverse 171 -#define KEY_rewinddir 172 -#define KEY_rindex 173 -#define KEY_rmdir 174 -#define KEY_s 175 -#define KEY_say 176 -#define KEY_scalar 177 -#define KEY_seek 178 -#define KEY_seekdir 179 -#define KEY_select 180 -#define KEY_semctl 181 -#define KEY_semget 182 -#define KEY_semop 183 -#define KEY_send 184 -#define KEY_setgrent 185 -#define KEY_sethostent 186 -#define KEY_setnetent 187 -#define KEY_setpgrp 188 -#define KEY_setpriority 189 -#define KEY_setprotoent 190 -#define KEY_setpwent 191 -#define KEY_setservent 192 -#define KEY_setsockopt 193 -#define KEY_shift 194 -#define KEY_shmctl 195 -#define KEY_shmget 196 -#define KEY_shmread 197 -#define KEY_shmwrite 198 -#define KEY_shutdown 199 -#define KEY_sin 200 -#define KEY_sleep 201 -#define KEY_socket 202 -#define KEY_socketpair 203 -#define KEY_sort 204 -#define KEY_splice 205 -#define KEY_split 206 -#define KEY_sprintf 207 -#define KEY_sqrt 208 -#define KEY_srand 209 -#define KEY_stat 210 -#define KEY_state 211 -#define KEY_study 212 -#define KEY_sub 213 -#define KEY_substr 214 -#define KEY_symlink 215 -#define KEY_syscall 216 -#define KEY_sysopen 217 -#define KEY_sysread 218 -#define KEY_sysseek 219 -#define KEY_system 220 -#define KEY_syswrite 221 -#define KEY_tell 222 -#define KEY_telldir 223 -#define KEY_tie 224 -#define KEY_tied 225 -#define KEY_time 226 -#define KEY_times 227 -#define KEY_tr 228 -#define KEY_truncate 229 -#define KEY_uc 230 -#define KEY_ucfirst 231 -#define KEY_umask 232 -#define KEY_undef 233 -#define KEY_unless 234 -#define KEY_unlink 235 -#define KEY_unpack 236 -#define KEY_unshift 237 -#define KEY_untie 238 -#define KEY_until 239 -#define KEY_use 240 -#define KEY_utime 241 -#define KEY_values 242 -#define KEY_vec 243 -#define KEY_wait 244 -#define KEY_waitpid 245 -#define KEY_wantarray 246 -#define KEY_warn 247 -#define KEY_when 248 -#define KEY_while 249 -#define KEY_write 250 -#define KEY_x 251 -#define KEY_xor 252 -#define KEY_y 253 +#define KEY_eval 57 +#define KEY_exec 58 +#define KEY_exists 59 +#define KEY_exit 60 +#define KEY_exp 61 +#define KEY_fcntl 62 +#define KEY_fileno 63 +#define KEY_flock 64 +#define KEY_for 65 +#define KEY_foreach 66 +#define KEY_fork 67 +#define KEY_format 68 +#define KEY_formline 69 +#define KEY_ge 70 +#define KEY_getc 71 +#define KEY_getgrent 72 +#define KEY_getgrgid 73 +#define KEY_getgrnam 74 +#define KEY_gethostbyaddr 75 +#define KEY_gethostbyname 76 +#define KEY_gethostent 77 +#define KEY_getlogin 78 +#define KEY_getnetbyaddr 79 +#define KEY_getnetbyname 80 +#define KEY_getnetent 81 +#define KEY_getpeername 82 +#define KEY_getpgrp 83 +#define KEY_getppid 84 +#define KEY_getpriority 85 +#define KEY_getprotobyname 86 +#define KEY_getprotobynumber 87 +#define KEY_getprotoent 88 +#define KEY_getpwent 89 +#define KEY_getpwnam 90 +#define KEY_getpwuid 91 +#define KEY_getservbyname 92 +#define KEY_getservbyport 93 +#define KEY_getservent 94 +#define KEY_getsockname 95 +#define KEY_getsockopt 96 +#define KEY_given 97 +#define KEY_glob 98 +#define KEY_gmtime 99 +#define KEY_goto 100 +#define KEY_grep 101 +#define KEY_gt 102 +#define KEY_hex 103 +#define KEY_if 104 +#define KEY_index 105 +#define KEY_int 106 +#define KEY_ioctl 107 +#define KEY_join 108 +#define KEY_keys 109 +#define KEY_kill 110 +#define KEY_last 111 +#define KEY_lc 112 +#define KEY_lcfirst 113 +#define KEY_le 114 +#define KEY_length 115 +#define KEY_link 116 +#define KEY_listen 117 +#define KEY_local 118 +#define KEY_localtime 119 +#define KEY_lock 120 +#define KEY_log 121 +#define KEY_lstat 122 +#define KEY_lt 123 +#define KEY_m 124 +#define KEY_map 125 +#define KEY_mkdir 126 +#define KEY_msgctl 127 +#define KEY_msgget 128 +#define KEY_msgrcv 129 +#define KEY_msgsnd 130 +#define KEY_my 131 +#define KEY_ne 132 +#define KEY_next 133 +#define KEY_no 134 +#define KEY_not 135 +#define KEY_oct 136 +#define KEY_open 137 +#define KEY_opendir 138 +#define KEY_or 139 +#define KEY_ord 140 +#define KEY_our 141 +#define KEY_pack 142 +#define KEY_package 143 +#define KEY_pipe 144 +#define KEY_pop 145 +#define KEY_pos 146 +#define KEY_print 147 +#define KEY_printf 148 +#define KEY_prototype 149 +#define KEY_push 150 +#define KEY_q 151 +#define KEY_qq 152 +#define KEY_qr 153 +#define KEY_quotemeta 154 +#define KEY_qw 155 +#define KEY_qx 156 +#define KEY_rand 157 +#define KEY_read 158 +#define KEY_readdir 159 +#define KEY_readline 160 +#define KEY_readlink 161 +#define KEY_readpipe 162 +#define KEY_recv 163 +#define KEY_redo 164 +#define KEY_ref 165 +#define KEY_rename 166 +#define KEY_require 167 +#define KEY_reset 168 +#define KEY_return 169 +#define KEY_reverse 170 +#define KEY_rewinddir 171 +#define KEY_rindex 172 +#define KEY_rmdir 173 +#define KEY_s 174 +#define KEY_say 175 +#define KEY_scalar 176 +#define KEY_seek 177 +#define KEY_seekdir 178 +#define KEY_select 179 +#define KEY_semctl 180 +#define KEY_semget 181 +#define KEY_semop 182 +#define KEY_send 183 +#define KEY_setgrent 184 +#define KEY_sethostent 185 +#define KEY_setnetent 186 +#define KEY_setpgrp 187 +#define KEY_setpriority 188 +#define KEY_setprotoent 189 +#define KEY_setpwent 190 +#define KEY_setservent 191 +#define KEY_setsockopt 192 +#define KEY_shift 193 +#define KEY_shmctl 194 +#define KEY_shmget 195 +#define KEY_shmread 196 +#define KEY_shmwrite 197 +#define KEY_shutdown 198 +#define KEY_sin 199 +#define KEY_sleep 200 +#define KEY_socket 201 +#define KEY_socketpair 202 +#define KEY_sort 203 +#define KEY_splice 204 +#define KEY_split 205 +#define KEY_sprintf 206 +#define KEY_sqrt 207 +#define KEY_srand 208 +#define KEY_stat 209 +#define KEY_state 210 +#define KEY_study 211 +#define KEY_sub 212 +#define KEY_substr 213 +#define KEY_symlink 214 +#define KEY_syscall 215 +#define KEY_sysopen 216 +#define KEY_sysread 217 +#define KEY_sysseek 218 +#define KEY_system 219 +#define KEY_syswrite 220 +#define KEY_tell 221 +#define KEY_telldir 222 +#define KEY_tie 223 +#define KEY_tied 224 +#define KEY_time 225 +#define KEY_times 226 +#define KEY_tr 227 +#define KEY_truncate 228 +#define KEY_uc 229 +#define KEY_ucfirst 230 +#define KEY_umask 231 +#define KEY_undef 232 +#define KEY_unless 233 +#define KEY_unlink 234 +#define KEY_unpack 235 +#define KEY_unshift 236 +#define KEY_untie 237 +#define KEY_until 238 +#define KEY_use 239 +#define KEY_utime 240 +#define KEY_values 241 +#define KEY_vec 242 +#define KEY_wait 243 +#define KEY_waitpid 244 +#define KEY_wantarray 245 +#define KEY_warn 246 +#define KEY_when 247 +#define KEY_while 248 +#define KEY_write 249 +#define KEY_x 250 +#define KEY_xor 251 +#define KEY_y 252 /* ex: set ro: */ diff --git a/keywords.pl b/keywords.pl index d702a1a..eb0c0af 100755 --- a/keywords.pl +++ b/keywords.pl @@ -105,7 +105,6 @@ endpwent endservent eof eq -err eval exec exists diff --git a/lib/feature.pm b/lib/feature.pm index d53699e..73e4990 100644 --- a/lib/feature.pm +++ b/lib/feature.pm @@ -6,12 +6,11 @@ our $VERSION = '1.11'; my %feature = ( switch => 'feature_switch', say => "feature_say", - err => "feature_err", state => "feature_state", ); my %feature_bundle = ( - "5.10.0" => [qw(switch say err state)], + "5.10.0" => [qw(switch say state)], ); # latest version here @@ -88,14 +87,6 @@ C function. See L for details. -=head2 the 'err' feature - -C tells the compiler to enable the C -operator. - -C is a low-precedence variant of the C operator: -see C for details. - =head2 the 'state' feature C tells the compiler to enable C @@ -109,7 +100,7 @@ It's possible to load a whole slew of features in one go, using a I. The name of a feature bundle is prefixed with a colon, to distinguish it from an actual feature. At present, the only feature bundles are C and C, -which both are equivalent to C. +which both are equivalent to C. In the forthcoming 5.10.X perl releases, C will be equivalent to the latest C. diff --git a/pod/perlop.pod b/pod/perlop.pod index 355e8aa..9ef1aec 100644 --- a/pod/perlop.pod +++ b/pod/perlop.pod @@ -53,7 +53,7 @@ values only, not array values. nonassoc list operators (rightward) right not left and - left or xor err + left or xor In the following sections, these operators are covered in precedence order. @@ -522,9 +522,9 @@ for selecting between two aggregates for assignment: @a = scalar(@b) || @c; # really meant this @a = @b ? @b : @c; # this works fine, though -As more readable alternatives to C<&&>, C and C<||> when used for -control flow, Perl provides C, C and C operators (see below). -The short-circuit behavior is identical. The precedence of "and", "err" +As more readable alternatives to C<&&> and C<||> when used for +control flow, Perl provides the C and C operators (see below). +The short-circuit behavior is identical. The precedence of "and" and "or" is much lower, however, so that you can safely use them after a list operator without the need for parentheses: @@ -838,9 +838,9 @@ precedence. This means that it short-circuits: i.e., the right expression is evaluated only if the left expression is true. =head2 Logical or, Defined or, and Exclusive Or -X X X +X X X X -X X X +X X Binary "or" returns the logical disjunction of the two surrounding expressions. It's equivalent to || except for the very low precedence. @@ -865,13 +865,6 @@ takes higher precedence. Then again, you could always use parentheses. -Binary "err" is equivalent to C--it's just like binary "or", except it -tests its left argument's definedness instead of its truth. There are two -ways to remember "err": either because many functions return C on -an Bor, or as a sort of correction: C<$a = ($b err 'default')>. This -keyword is only available when the 'err' feature is enabled: see -L for more information. - Binary "xor" returns the exclusive-OR of the two surrounding expressions. It cannot short circuit, of course. diff --git a/pp.c b/pp.c index bc84f60..d55c4a8 100644 --- a/pp.c +++ b/pp.c @@ -416,7 +416,7 @@ PP(pp_prototype) char str[ MAX_ARGS_OP * 2 + 2 ]; /* One ';', one '\0' */ if (code == -KEY_chop || code == -KEY_chomp - || code == -KEY_exec || code == -KEY_system || code == -KEY_err) + || code == -KEY_exec || code == -KEY_system) goto set; if (code == -KEY_mkdir) { ret = sv_2mortal(newSVpvs("_;$")); diff --git a/t/lib/feature/err b/t/lib/feature/err deleted file mode 100644 index 638b5a6..0000000 --- a/t/lib/feature/err +++ /dev/null @@ -1,66 +0,0 @@ -Check the lexical scoping of the err keyword. -(The actual behaviour is tested in t/op/dor.t) - -__END__ -# No err; should be a syntax error. -use warnings; -my $undef err print "Hello!\n"; -EXPECT -Bareword found where operator expected at - line 3, near "$undef err" - (Missing operator before err?) -Unquoted string "err" may clash with future reserved word at - line 3. -syntax error at - line 3, near "$undef err " -Execution of - aborted due to compilation errors. -######## -# With err, should work -use warnings; -use feature "err"; -my $undef err print "Hello", "world"; -EXPECT -Helloworld -######## -# With err, should work in eval too -use warnings; -use feature "err"; -eval q(my $undef err print "Hello", "world"); -EXPECT -Helloworld -######## -# feature out of scope; should be a syntax error. -use warnings; -{ use feature 'err'; } -my $undef err print "Hello", "world"; -EXPECT -Bareword found where operator expected at - line 4, near "$undef err" - (Missing operator before err?) -Unquoted string "err" may clash with future reserved word at - line 4. -syntax error at - line 4, near "$undef err " -Execution of - aborted due to compilation errors. -######## -# 'no feature' should work -use warnings; -use feature 'err'; -my $undef err print "Hello", "world"; -no feature; -my $undef2 err "Hello", "world"; -EXPECT -Bareword found where operator expected at - line 6, near "$undef2 err" - (Missing operator before err?) -Unquoted string "err" may clash with future reserved word at - line 6. -String found where operator expected at - line 6, near "err "Hello"" - (Do you need to predeclare err?) -syntax error at - line 6, near "$undef2 err " -Execution of - aborted due to compilation errors. -######## -# 'no feature "err"' should work too -use warnings; -use feature 'err'; -my $undef err print "Hello", "world"; -no feature 'err'; -$undef err print "Hello", "world"; -EXPECT -Bareword found where operator expected at - line 6, near "$undef err" - (Missing operator before err?) -Unquoted string "err" may clash with future reserved word at - line 6. -syntax error at - line 6, near "$undef err " -Execution of - aborted due to compilation errors. diff --git a/t/lib/warnings/op b/t/lib/warnings/op index 891677f..a744590 100644 --- a/t/lib/warnings/op +++ b/t/lib/warnings/op @@ -680,15 +680,10 @@ Value of readdir() operator can be "0"; test with defined() at - line 4. ######## # op.c use warnings 'misc'; -use feature 'err'; open FH, " err $_ = 1; ($_ = ) // ($_ = 1); opendir DH, "."; -$_ = readdir DH err $_ = 1; -$_ = <*> err $_ = 1; %a = (1,2,3,4) ; -$_ = each %a err $_ = 1; EXPECT ######## # op.c diff --git a/t/op/cproto.t b/t/op/cproto.t index 3bc8b27..cc2426a 100644 --- a/t/op/cproto.t +++ b/t/op/cproto.t @@ -7,7 +7,7 @@ BEGIN { } BEGIN { require './test.pl'; } -plan tests => 238; +plan tests => 237; while () { chomp; @@ -68,7 +68,6 @@ endpwent () endservent () eof (;*) eq ($$) -err () eval undef exec undef exists undef diff --git a/t/op/dor.t b/t/op/dor.t index 04e0f7d..602a03c 100644 --- a/t/op/dor.t +++ b/t/op/dor.t @@ -8,10 +8,9 @@ BEGIN { } package main; -use feature "err"; require './test.pl'; -plan( tests => 35 ); +plan( tests => 31 ); my($x); @@ -26,17 +25,6 @@ is($x // 0, '', ' // : left-hand operand defined but empty'); like([] // 0, qr/^ARRAY/, ' // : left-hand operand a referece'); -$x=1; -is(($x err 0), 1, ' err: left-hand operand defined'); - -$x = undef; -is(($x err 1), 1, ' err: left-hand operand undef'); - -$x=''; -is(($x err 0), '', ' err: left-hand operand defined but empty'); - -like(([] err 0), qr/^ARRAY/, ' err: left-hand operand a referece'); - $x=undef; $x //= 1; is($x, 1, ' //=: left-hand operand undefined'); diff --git a/t/run/switches.t b/t/run/switches.t index 7312e1e..317586e 100644 --- a/t/run/switches.t +++ b/t/run/switches.t @@ -11,7 +11,7 @@ BEGIN { BEGIN { require "./test.pl"; } -plan(tests => 62); +plan(tests => 61); use Config; @@ -310,11 +310,6 @@ is( $r, "Hello, world!\n", "-E say" ); $r = runperl( - switches => [ '-E', '"undef err say q(Hello, world!)"'] -); -is( $r, "Hello, world!\n", "-E err" ); - -$r = runperl( switches => [ '-E', '"undef ~~ undef and say q(Hello, world!)"'] ); is( $r, "Hello, world!\n", "-E ~~" ); diff --git a/toke.c b/toke.c index 428a7c2..be7bacf 100644 --- a/toke.c +++ b/toke.c @@ -4235,7 +4235,6 @@ Perl_yylex(pTHX) switch (tmp) { case KEY_or: case KEY_and: - case KEY_err: case KEY_for: case KEY_unless: case KEY_if: @@ -5922,9 +5921,6 @@ Perl_yylex(pTHX) case KEY_eof: UNI(OP_EOF); - case KEY_err: - OPERATOR(DOROP); - case KEY_exp: UNI(OP_EXP); @@ -7328,14 +7324,6 @@ Perl_keyword (pTHX_ const char *name, I32 len, bool all_keywords) goto unknown; - case 'r': - if (name[2] == 'r') - { /* err */ - return (all_keywords || FEATURE_IS_ENABLED("err") ? -KEY_err : 0); - } - - goto unknown; - case 'x': if (name[2] == 'p') { /* exp */