Have you read FMTYEWTK about Prototypes by Tom Christiansen yet? It's the reference for everything that's wrong/annoying/misunderstood about Perl's prototypes.

In other programming experience I had developed the opinion that protypes were a good thing as they provide usage enforcement
Prototypes in Perl are not analagous to prototypes in other languages. Calling them "prototypes" is a bit of a misnomer. But Tom Christiansen describes this better than I can.

I know many monks, myself included, only use prototypes to get subs to look like builtins, especially passing a bare block as the first argument (as in grep { ... }) or an array ref (as in splice @arr). They're ok occasionally for this kind of syntactic sugar, but they're not as useful as you'd think for actually enforcing parameters. As I said, read that article if you haven't read it yet, otherwise read it again ;)

blokhead


In reply to Re: Prototyping Subs: Good,Bad,Indifferent by blokhead
in thread Prototyping Subs: Good,Bad,Indifferent by knexus

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.