![]() |
|
Welcome to the Monastery | |
PerlMonks |
comment on |
( #3333=superdoc: print w/replies, xml ) | Need Help?? |
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. In reply to Re^3: Why does eof have a prototype?
by haukex
|
|