Revert "[perl #95550] Remove prototypes from (l)stat"
authorFather Chrysostomos <sprout@cpan.org>
Fri, 12 Aug 2011 05:15:05 +0000 (22:15 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Fri, 12 Aug 2011 13:28:09 +0000 (06:28 -0700)
commit93e6f00ed5ef68c787902ea1f88084f619b59561
tree902af54a60b115dfb20e2d4b4c30042a5ce19ddd
parent1766075810712c2dd8a5fd6ced3ee862f7de045c
Revert "[perl #95550] Remove prototypes from (l)stat"

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.
op.c
pod/perldelta.pod
t/op/cproto.t