Rakudo Star - a useful, usable, "early adopter" distribution of Perl 6
rakudo.org
rakudo.org
* It needs perl5 to build.
* Hello World still works.
* Perl can now compete with Java for slow startup.
* One of my pet perl hates, the inability to write "sub foo($a, $b, $c) {" is fixed.
I think you're in for a good surprize there, you can even do
subset Even of Int where { $_ % 2 == 0 };
sub foo(Even $a) {say $a;}
foo(2); # prints 2
foo(3); # Constraint type check failed for parameter '$a'
Here is the perl6 example using MooseX::Declare (http://search.cpan.org/dist/MooseX-Declare/) in perl5:
use 5.012;
use MooseX::Declare;
class Foo {
use MooseX::Types -declare => [ qw(Even) ];
use MooseX::Types::Moose qw(Int);
BEGIN {
subtype Even, as Int, where { $_ % 2 == 0 };
}
method bar ( Even $a ) { say $a }
}
my $foo = Foo->new;
$foo->bar( 2 ); # => prints 2
$foo->bar( 3 ); # => throws errorOne of the other cool capabilities of perl6 is the rules system, expanding on regexs so you can work with full on grammars. The perl6 grammar, written in perl6:
It's clear that doing it in an older syntax is clearly less elegant. However, it's very impressive though that the back ports of Perl 6 features to Perl 5 are proceeding relatively nicely though. The work on Perl 6 has definitely been a boon to 5.
XML parser defined using perl6 grammar rules: http://github.com/krunen/xml/blob/master/lib/XML/Grammar/Doc...
That's my next area of focus for Rakudo optimizations.
I don't know what Perl 6's future will be; I have high hopes. But it's already moved me forward.
See http://github.com/moritz/try.rakudo.org for the source code.
The one liner limitation still apply, but they can be very loooong one liners ;-)
EDIT: In particular, I think macros and stm will be killer features with respect to other languages, once they're implemented in Rakudo.
I'm not an early adopter. I think startups are risky enough and technology choices are but one point of differentiation in business.
Piers Cawley happily gave up on ruby and came back to perl5 as a result of it - you should give it a play before looking at a more drastic switch.