rakudobrew is similar to perlbrew, but it's for Rakudo (a.k.a., Perl 6), the Perl-inspired language that we've all come to have a love/hate relationship with. I urge you to try it out, but first, some interesting new developments that you should probably know about.

By now you've probably heard of Perl 6, either the greatest dynamic programming language ever created or one of the longest-running shaggy dog stories in history (more so than even Duke Nukem Forever). That being said, with MoarVM and other experiments, it looks like Perl 6 is finally turning an interesting corner.

There's an old saying in programming of "make it good, then make it fast." They're finally working on making Perl 6 fast. In some examples, it's actually an order of magnitude faster than Perl 5. That's astonishing given that Perl 5 is already the fastest dynamic language out there. In other examples, it's more than an order of magnitude slower, but with their new profiling tools, the Perl 6 devs are quickly finding performance bottlenecks and, more importantly, finally have an architecture that they're convinced is good enough to optimize.

So, um, yeah. You've heard all this before. You've gotten your hopes up. You've been let down. Christmas after Christmas, there were no presents under that red-black tree.

So let's look at this differently. Moore's law is coming to an end. It has to be. There are simply physical limitations (they're called subatomic particles) beyond which we can't go. Until someone comes up with a revolutionary method of computation (don't hold your breath on quantum computers), we are going to see a change in how software works. If you want it faster, you don't just wait 18 months for new hardware; you go concurrent (we'll skip the distinction between concurrency and parallelism for now).

There is not, to my knowledge, a single popular dynamic programming language which has a working concurrency model. They're all broken in fundamental ways. Perl 6 aims to change that by making concurrency, if not easy, at least easier. And it's working now. In fact, even if the language is slow, if it makes it easier to do concurrent programming there are those who will adopt it (I'm looking at you, Erlang). Perl 6 is relatively easy to write and it's concurrency is easy to read. Let's take a look.

First, install rakudobrew .

git clone https://github.com/tadzik/rakudobrew ~/.rakudobrew

Then add that to your $PATH (I put mine in my .bashrc file):

export PATH=~/.rakudobrew/bin:$PATH

Then build it and (optionally) install the panda package manager (because we need more package managers, right?):

rakudobrew build moar && rakudobrew build-panda

Now test it:

$ perl6 -e 'say "Hello, World"' Hello, World

So let's randomly sleep 100 times:

$ time perl6 -e 'for 1 .. 100 { sleep rand }' real 0m50.567s user 0m0.288s sys 0m0.040s

OK, that took almost a minute. Now let's run that in parallel:

$ time perl6 -e 'await do for 1 .. 100 { start { sleep rand } }' real 0m3.635s user 0m0.367s sys 0m0.100s

50 seconds down to 3 seconds. Not bad!

What does that code mean, though?

start means "start this code in another process and return a promise". A promise is merely a piece of asynchronous work that the system will try to complete. In other words, start returns a promise to complete this code in another process.

await takes a list of promises and waits for them to finish. It's a blocking function. Promises don't block, but await does:

$ time perl6 -e 'for 1 .. 100 { start { sleep rand } }' real 0m0.284s user 0m0.237s sys 0m0.076s

(But don't do that. Spawned threads will be taken down when the program exits, so make sure you wait for them to finish)

Jonathan Worthington has a brilliant talk about Perl 6 concurrency and here's the video for it:

Or you can read this blog post, if you prefer that.

This is important. Having somewhat easy-to-use, working parallel programming in a language will be a killer feature, regardless of whether or not it's a dynamic language. That being said, you may not care about this. You want to know if the language is fun and easy.

There's a Learn Y in X Minutes post for Perl 6 which explains many of the concepts. That should get you up to speed on the basics rather quickly.

Yes, Perl 6 still has bugs. I found two rather quickly, but with rakudobrew it will be easier to stay up to date and the concurrency work is very interesting.

If you need to dive into the language, you can also read the Perl 6 docs. There's a lot of new terminology, but the language is now stable enough that a tutorial is merited.

If I had the opportunity, I think I'd spend a lot of my time porting a Web framework to Perl 6. Sadly, I have to pay the bills and I can't, but I'm finding Perl 6 to be a lovely thing to play with. How many of you can say you still love someone/something after almost a decade and a half (ooh, I'm going to hell for that last comment).