eof(); and eof; are (magically) different syntax for eof, and this difference can't be expressed with prototypes.
I'm not sure this is a job for prototypes. Every Perl function can be called with and without parens (given the compiler knows about it), it's always valid syntax. The trick would be to detect inside a hypothetical sub myeof whether the parens are there are not - how would one do this with prototypes? Seems more like a job for something like caller. It's also worth noting that AFAIK eof is the only function in Perl that behaves this way... the exception that confirms the rule ;-)
Interesting side note: see eof in perltie.
A "can be parsed without errors" criteria is not enough for me.
I don't think that's the criteria. It's more like: "Every variation of the builtin's syntax can be expressed by prototypes" - look at threads like Prototype like sort()? where everyone's implementations got close to the original, but noone was able to replicate all of sort's syntax. All of eof's syntax can be replicated, but not its functionality. That's where the difference is.
I do understand how you are interpreting that piece of documentation, but I think you should cut the authors some slack :-) eof is a unique case, and knowing this, I don't think that passage is inaccurate.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
|
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
|
|