Do you use prototypes?Generally no. There are a few circumstances when I might use the empty prototype (e.g a static function) or take use of passing a coderef as the first argument (for syntactic symmetery), but as a general rule no.
What are the best arguments for and against them?Tom Christiansen presents a pretty compelling argment against prototypes in his classic Far More Than Everything You've Ever Wanted to Know about Prototypes in Perl. The for arguments however are few and far between. I personally don't think they have a place in most code, but like any of perl's idiomatic features there are some circumstances where they are appropriate, such as implicitly declaring constants (see. Constant Functions in perlsub).
Is there any way to keep the & characters on routine calls and still have prototypes checked?No, as by definition an ampersand on the beginning of the function call removes prototype checking (see. perlsub for more info).
_________
broquaint
In reply to Re: Perl Prototypes
by broquaint
in thread Perl Prototypes
by hawtin
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |