in reply to Re^5: Read all the file path having text document
in thread Read all the file path having text document

... - bizarre.

Not at all. It's like the empty string matching any string. Once you've declared a prototype, there can be a mismatch, but not before.

  • Comment on Re^6: Read all the file path having text document

Replies are listed 'Best First'.
Re^7: Read all the file path having text document
by GrandFather (Saint) on Nov 30, 2008 at 02:12 UTC

    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.

      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.

      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.