I don't understand. How is a forward declaration not a declaration?
In both cases there is a mismatch between the forward declaration and the actual declaration. Not raising a warning in the case of a blank prototype in the forward declaration with a non-blank prototype in the actual declaration seems bizarre.
Perl's payment curve coincides with its learning curve.
| [reply] |
I think not having a prototype in the forward declaration is kinda
like saying "I don't care, everything is fine", so when someone comes
along later and declares a specfic prototype, then this is, well, fine.
OTOH, if you say "I want the subroutine be called like this", and
someone else later wants to have it some other way, you have a tiff...
Makes sense to me.
| [reply] |
Well, a declaration is just a declaration - not a definition. If you add prototypes to the declaration, the declaration
*is* a definition wrt the prototype part, although the subroutine body (i.e. the content of the coderef in the CODE typeglob
slot) still isn't set up for lack of code to be compiled. That would be done later, in the definition. Prototypes set up
earlier (via declaration) have to match, then.
| [reply] |