We should all be familiar with the problems related to prototypes in Perl. Here are the two biggies:
- they don't work like prototypes in other languages, so people misunderstand them.
- they don't apply to all ways of calling a subroutine.
The second item is the one I am curious about at the moment.
I know of two ways to subvert/work around/ignore prototype enforcement when calling a subroutine:
- Call the sub as a method.
Foo->subroutine_name();
- Call the sub with a leading
&
sigil.&subroutine_name();
Are there any other interesting cases I've missed?
Udpate:
@brian d foy, I don't particularly want to evade prototypes, but I wondered "how many ways are there to do it?" I ask this question out of curiosity.
@jrockway, I agree with you, and I believe that you have more explicitly and more concisely described my first point regarding the problems with prototypes, that people misunderstand them. Perhaps the problem lies in programmer expectations and not in the feature. But that is really a philosophical question of the sort I don't want to have.