Three things I'd Change About Perl
Ovid asks about three things you'd change about Perl, which is similar to my standard interview question What are five things you hate about Perl?. I never really answered the question myself, although I did let go of one thing in my Frozen Perl 2011 Keynote: the connection between module names and filenames. Breaking that connection helps with my second thing.
I want first-class classes that I can store in a variable. I want to be able to load multiple and different versions of a distribution. As part of that, I'd want to load distributions, not particular modules. I'd get to the modules through the distribution. I haven't really thought about the syntax for this, though.
I would also be able to load things lexically:
sub some_sub {
my $lwp_dist = import( 'LWP', 5.12 );
my $simple = $lwp_dist->class( 'LWP::Simple' );
$single->get( $url );
}
sub some_other_sub {
my $lwp_dist = import( 'LWP', 4.45 );
my $simple = $lwp_dist->class( 'LWP::Simple' );
$single->get( $url );
}
I would then also be able to use two different versions in the same scope:
sub some_other_sub {
my $dbm_deep_123 = import( 'DBM::Deep', 1.23 );
my $dbm_deep_223 = import( 'DBM::Deep', 2.23 );
my $db_old = $dbm_deep_123->new( $file );
my $db_new = $dbm_deep_123->new( $new_file );
...copy the old to the new...;
}
But if I can do that, I can create truly anonymous classes without using a package name hack:
my $class = ...some builtin...;
From there, maybe some of that Moosey stuff makes the stuff inside the class. Once I have the class, I just call methods on it:
my $instance = $class->new(...);
I think this is probably in Perl 6 with the Mu stuff they added.
The third thing is the boring function signature thing that everyone wants.