Fri, 22 Oct 2010

How core is core?

In the Perl 5 world, "core" modules are a big topic. Some people can't (or
think they can't) install any modules beyond "core", and suggest to add more
useful modules to "core". Others think that we should have fewer core modules,
to reduce the maintenance load on the perl 5 porters.

So, what's the deal in Perl 6? which modules will be "core", and who
decides? Will we learn from Perl 5's mistakes, whatever you consider them to
be?

To answer that question we have to explore what "core" really means. In
Perl 5, it's just a module that's included in the "perl" package that's
uploaded to CPAN. In Perl 6, there are several possible meanings:

A type that's available to any Perl 6 program without loading anything
(A)

A module that ships with all Perl 6 compilers (B)

A module that ships with a Perl 6 distribution (C)

Note that all three concepts known in Perl 5 too - UNIVERSAL is category A,
warnings is category B,
and there are some modules that are installed by default by ActiveState Perl
or Strawberry Perl.

The Perl 6 specification talks about category A core modules in the
S32/Setting Library documents. Currently things like DateTime, Date
and IO::Socket::INET fall into that category. Maybe someday they will be
automatically loaded on demand, to cause less strain for all programs that
don't use them.

Category B is currently rather sparse, it only consists of Test.pm (and in
the case of Rakudo also Set.pm, but that should eventually become a category A
core module). This is where we learned from old mistakes: keeping compilers
and distributions separate reduces the maintenance load for the compiler
writers. Do you as a user want a module installer? then you should be
installing a distribution, not just a compiler

Everybody can start their own distribution, based on any existing compiler.
That's a good thing. Whoever maintains a distribution gets to decide what to
ship with it. Currently the Rakudo developers both write a compiler
(commonly referred to as Rakudo), and a distribution called
Rakudo Star. The compiler will continue to ship with very few
modules, the distribution will adapt to the need of the users.

I fully expect there to be specialized distributions in the next few years
or decades: maybe a sysadmin distribution, a web developer's distribution and
so on. Or maybe that specialization will be realized by bundles. We'll
see.

Perl 5 also has "dual-life" modules, which are both released to CPAN and
are part of the core. Since Perl 6 has almost no type B core modules, there
will be almost no need for dual-life modules either. I expect that most
distribution makers will rather import modules that are maintained by third
parties, rather than maintaining them on their own - kinda like Linux
distributions package popular and useful software, but only actively
maintain it in rare cases.