It turns out this problem is more knotty than I initially realised.
stat had a prototype of (*), even though it could be called with no
arguments. Since the (*) prototype does not parse its argument the
same way that stat parses *its* argument, I thought that changing (*)
to (;*) would be no better, since it’s still not correct. So I simply
set the prototype to undef.
My thinking was faulty, for two reasons:
• The prototype serves to indicate the precedence, not just the types
of arguments. An undefined prototype on an overridable prefix func-
tion implies that it takes a list. So this causes problems for the
imminent &CORE::subs feature, as there is not yet a clean mechanism
for CVs to parse their arguments.
• The (*) prototype character does not parse the same way as *any*
built-in function with that character in its prototype. So stat is
no worse than any other built-in. It doesn’t make sense to remove
the prototype from stat without removing it from about 40 other
built-in functions; and that’s where pedantry conflicts with
usefulness.
This commit restores the (*) prototype to stat and lstat. The next
commit will give it a (;*) prototype, as that matches it more closely.
It’s not perfect, but it’s no worse that other built-ins with a * in
their prototypes.
case KEY_and : case KEY_chop: case KEY_chomp:
case KEY_cmp : case KEY_exec: case KEY_eq :
case KEY_ge : case KEY_gt : case KEY_le :
- case KEY_lstat : case KEY_lt : case KEY_ne : case KEY_or :
- case KEY_stat : case KEY_system: case KEY_x : case KEY_xor:
+ case KEY_lt : case KEY_ne : case KEY_or :
+ case KEY_system: case KEY_x : case KEY_xor :
return NULL;
case KEY_keys: case KEY_values: case KEY_each:
retsetpvs("+");
=item *
-The prototypes for the core functions C<stat> and C<lstat> have been
-removed, as they were incorrect, because their syntax cannot be replicated
-by Perl subroutines.
-
-=item *
-
Most dereferencing operators (C<${}>, etc.) used to call C<FETCH> twice on
a tied operand when doing a symbolic dereference (looking up a variable by
name, which is not permitted under C<use strict 'refs'>). Only C<&{}> did
localtime (;$)
lock (\[$@%*])
log (_)
-lstat undef
+lstat (*)
lt undef
m undef
map undef
sprintf ($@)
sqrt (_)
srand (;$)
-stat undef
+stat (*)
state undef
study undef
sub undef