<pedantic> Four of the seven things you cited (if, else, for, while) aren't really functions, per se, but are flow-control "operators" well, not "operators", exactly, but keywords in syntactic constructions. </pedantic>

Yep, incidentally AIUI in Perl 6 they will actually become much more of actual functions. I suspect this is inspired by Smalltalk and perhaps some similar languages, in which, for example, IIRC a conditional is of the form:

CONDITION ifTrue: [DO SOMETHING] ifFalse: [DO SOMETHING ELSE]

and it works in such a way that the message ifTrue:ifFalse: is sent to the (boolean) object returned by CONDITION and the latter responds to it by selecting to the appropriate block sent as a parameter depending on its own value. In Perl 6 objects are pervasive too, but I believe that control structures are rather of a functional nature, however with this distinction in place, I still think that a somewhat comparable degree of orthogonality and consistency is being sought.

As for PHP's 3000 functions, I suppose that probably relates to having a different perspective on "modularizing" code, and having a different threshold for the trade-off between creating a uniform run-time environment (bloated with functions that will only be used by 5% of PHP programmers), vs. managing a site-specific module library (where processes only load the functions they use, but there's somewhat more care needed for maintenance).

Yep, there are various reasons why generally Perl crowds do not like PHP, and the latter being bloated with core functions is one of those. Perhaps Perl itself has "too many" functions to begin with, but at least a large number of them is consistent enough in naming and corresponding functionality, while one accusation moved to PHP's is that due to the "urge" to stuff so many of them together, quite a lot of them do not follow any logical naming scheme...

Of course, should one want the language with the least number of built-in functions, and FWIW of keywords, she should seek for io, which strives for extreme simplicity and is actually an interesting, not purely academic, language.


In reply to Re^2: functional functions by blazar
in thread functional functions by punkish

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.