Way back when, the Perl (1, 2, 3, 4, 5) core was defined as “whatever Larry Wall says it is”. Since the advent of the Perl 6 project, Larry has spent less and less time on Perl 5, and he hasn’t been an active participant on the perl5-porters list for years. Absent Larry, I think the Perl 5 core would benefit from an explicit set of principles.
I don’t get to decide what those principles are, but I have some suggestions.
There is more than one way do it but sometimes consistency is not a bad thing either.
For a long time, TIMTOWTDI was the Perl motto. In the past few years, we’ve seen the community move towards agreeing on community standards. This agreement is by no means universal, but it’s better than nothing.
This principle says that you can’t argue against an addition to the core because it favors one way of doing things over another. That’s no longer a valid argument in Perl land. You can, of course, argue that the way being favored is not the best way.
Perl 5 DWIM, But Only When There’s Broad Agreement on WIM
(DWIM == Does What I Mean)
The smartmatch operator provides a perfect negative example. Its behavior in 5.12 and 5.14 is insanely complex (try reading the docs in perlsyn). There’s no way to achieve agreement on something this complicated. Ricardo Signes has proposed a simple alternative. It only has five cases. It’s not as smart, but that’s good!
Another way to phrase this might be that “Perl 5 is clever, but not too damn clever.”
Features Are Extensions
All new features should be written as extensions. In other words, new features should live in modules (though those modules may be XS). There’s been a lot of work by Zefram (and others?) to make it possible to extend Perl using Perl. That should become the standard mechanism for adding new features.
OO is Here, Deal With It
The Perl 5 core should embrace object-oriented programming. The more that object-orientation takes over the core, the better. Wouldn’t it be nice if things like
$0 all returned/used objects?
Just Cause OO is Here Doesn’t Mean Functional and Imperative Aren’t
Perl 5 is a multi-paradigm language, and that’s great. We never want to change that. You should be able to write functional, imperative, and OO Perl, switching between the paradigms as appropriate.
Your Principle Here
These are my suggestions. What are yours? I think it would be fantastic if the community could agree on a few key principles. In my ideal world, discussions about changes to the core would always refer back to these principles, in the same way that we used to refer back to Larry.