I recently posted a question in which it was kindly mentioned that my use of prototypes was probably inappropriate. I went ahead and did some reading on it, and I'm still a bit curious and have a few questions.
First, why *doesn't* Perl support strict function-argument specification? I can see that prototypes don't really do this, but... I'm surprised that there is no easy way to enforce it. Is this a result of the way Perl seamlessly casts between ints and strings?
Second, many of the prototype-problems seem to come down to the functions accepting "weirdness" despite the prototype. But from the article it did appear that passing reference to data-structures (e.g. sub foo(\%) {}) wasn't too problematic: mainly coming down to issues of "semantic sugar" rather than unexpected behaviour. Is that a misconception?
It still seems "clearer" to my eyes to see the data-types expected of a function specified in its declaration. I'm trying to "adjust" my eye-sight by just taking it out and putting it in comments at the start of the routine, but I figured I should try to understand why I'm doing it this way as best as possible!
In reply to Considering Prototypes by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |