Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: functional functions

by graff (Chancellor)
on May 30, 2007 at 04:31 UTC ( #618107=note: print w/ replies, xml ) Need Help??


in reply to functional functions

<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>

You may have noticed, in the full perlfunc man page, how the functions can be grouped into categories, and some of those categories are quite specialized -- some are even OS-specific (check the section about "Portability").

To the extent that your normal coding tasks don't take you through some of those categories, you never happen to need those functions. So what? It's good enough to have a vague sense about the categories that are out there, and then you just learn the functions as you need them (i.e. if you don't need them, don't bother and don't worry about it).

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).

If you counted up everything provided via supplemental CPAN modules, the total number of functions available in Perl is surely an order of magnitude greater than 3000. Thankfully, you really only need to learn about the ones that are relevant to your task. (But then, sometimes you have to figure out which of several alternative sets of functions would be best -- not a simple or linear task.)


Comment on Re: functional functions
Download Code
Re^2: functional functions
by sanPerl (Friar) on May 30, 2007 at 05:07 UTC
    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.
    I think punkish is very much aware of this fact. Considering that he is into Perl programming since 4+ years. I think what he meant is, till date he used to developed complicated logics using loops, conditions etc, rather than simply using built-in functions.
Re^2: functional functions
by blazar (Canon) on May 30, 2007 at 09:57 UTC
    <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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://618107]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (18)
As of 2014-12-22 15:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (119 votes), past polls