Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: On the rejected additions to List::Util

by borisz (Canon)
on Apr 28, 2009 at 19:54 UTC ( #760723=note: print w/ replies, xml ) Need Help??


in reply to On the rejected additions to List::Util

- The module author determinate what belongs to the API.
- As you pointed out all rejected functions are already in List::MoreUtils. I'm strictly against duplicating every function in all modules.
- I like clean simple API's much more than a collection of oneliners.

Boris


Comment on Re: On the rejected additions to List::Util
Re^2: On the rejected additions to List::Util
by Porculus (Hermit) on Apr 28, 2009 at 20:25 UTC
    The module author determinate what belongs to the API.

    Normally, yes. Does that still apply to core modules like List::Util? I'd always assumed that authors gave up a certain measure of control in exchange for having their module distributed as a fundamental part of the Perl standard library.

    As you pointed out all rejected functions are already in List::MoreUtils. I'm strictly against duplicating every function in all modules.

    The question is more why List::MoreUtils has to exist at all. Why not put the functions in List::Util and do away with List::MoreUtils completely? Isn't it simpler and cleaner to have one utility module instead of several?

    The other issue is that List::MoreUtils is not a core module. That means there is no guarantee it will always be available. This is a big problem for many people. We don't all have root on the machines our code runs on. We might not even have access to those machines, in which case we are unlikely to have the clout to insist that third-party modules are installed on them. If functionality is not in the core libraries, we might be forced to reinvent these wheels again and again and again. How is that good?

    I like clean simple API's much more than a collection of oneliners.

    Do you think it's cleaner to have all the oneliners copied and pasted into the start of every script that uses them? Do you think it's simpler to have to remember which of several list utility libraries each basic function is in?

      The arithmetic mean, geometric mean, mode, median, etc of a group of numbers are not properties of a generic list of scalars. There is no meaningful arithmetic mean of qw( Porculus mr_mischief metaperl ikegami ) for example. Those are statistical properties, and I believe rightly belong in the Statistics name space rather than the List name space.
      You do not need root access to use modules or install them. It is just a little more painful to install.
      The question is more why List::MoreUtils has to exist at all. Why not put the functions in List::Util and do away with List::MoreUtils completely? Isn't it simpler and cleaner to have one utility module instead of several?
      One reason is I use List::MoreUtils for years and do not plan to change all scripts. But a bit overdone, you ask to fold CPAN into the core? A lot of my scripts use XML::LibXML and DBI and HTML::Template. I like to get them into the core too.
      Do you think it's cleaner to have all the oneliners copied and pasted into the start of every script that uses them? Do you think it's simpler to have to remember which of several list utility libraries each basic function is in?
      Often yes, since I have to read learn every silly simple function. Sure it is not a problem, if I add some simple handy functions to my script as well. I even like the split between the core functions and the handy glue. Or you could use List::AllUtils, but thats again not in the core.
      Boris

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (11)
As of 2014-09-22 10:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (189 votes), past polls