This is a good question:

Just out of curiousity, is it because standard Perl functions do not specify how many parameters they need at a minimum, so the compiler cannot tell if a function is satisfied? Because, if it is, couldn't we just use prototypes?

The reason that my "currying" doesn't do real currying isn't so much because it's a technical challenge but because real currying doesn't mesh with Perl's (powerful and cool) calling semantics. Let me explain why I don't like real currying in Perl (5).

First, and most important, it requires a programmer to make a design-time decision to support currying. Currying hits its stride only when it is pervasive, and I don't want to limit its use to the functions that have been made "curry ready" ahead of time by having been anointed with the right prototypes or annotations. I want to be able to use currying with existing code bases.

Second, there are many useful Perl functions for which we don't have any way to differentiate among arguments. What is "curriable" for these functions is solely at the discretion of the caller. I want a currying solution that works well for these functions, too.

Third, I think that currying is best when it is free. Having to make annotations just raises its cost. In languages where you already must make such annotations, the currying comes at no additional charge. But for Perl, the charge isn't necessary and (as I have argued above) doesn't buy us much.

Ultimately, I'm not concerned that we don't have "real" currying. I would rather we have a useful currying-like concept that makes sense for Perl.

Thanks for the question!

Cheers,
Tom


In reply to Re^4: Near-free function currying in Perl by tmoertel
in thread Near-free function currying in Perl by tmoertel

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.