Thursday, April 11, 2013

Perl 6 is my MMORPG expansion pack: Perler's Handbook II

Three years back, masak++ wrote an excellent post, comparing his participation in the Perl 6 community to playing an online role-playing game.  And participating in the community has become a similar experience in my own life:
  • It is time-consuming: I spend hours contemplating new puzzles.
  • Dangers lurk about: I have to carefully avoid bugs that aren't at my level to squash yet.
  • Addictive properties: I can't go to bed until I pass just that one more test.
  • Great glory awaits those who triumph: in the form of IRC karma.
  • And most of all, it is fun.

And just as in RPGs, balanced parties and teamwork are the key to success.  The compiler improves with testers and application developers helping the implementers find bugs.  The ecosystem grows faster with advocates helping to recruit new users. Everyone plays an important part.

But looking at masak's post, I didn't seem to see my own role in the character class descriptions he wrote.  Obviously, we need to have more base classes to describe the full range of participation in the community.  So without further ado, here are the new character classes:


Calm and collected, the Monk contemplates the meaning of Mu and recites mantras like "There Is More Than One Way To Do It".  Where a Priest might answer newbie questions and offer helpful advice, a Monk will go deeper, meditating on a question until reaching enlightenment.  Because they are similar to the warrior class, they will sometimes go so far as to implement the answer to your query.

Being a monk requires wisdom to contemplate mysterious new problems, constitution to deal with newbies, and strength to implement solutions to problems.  Given the way TimToady++ has been flooding Rosetta Code lately with new Perl 6 examples, he just might be multi-classing in Monk.

For now the life of the Monk is solitary, and they can only be found by traversing to the remote mountain temple (actually #perl6).  But one day, the gates of the monastery will be flung open, and all will be able to seek their counsel -- so saith masak's prophecy.


A master of the wild, the druid is most knowledgeable about the monsters lurking in our code: bugs.  They help to manage these wild creatures by managing bug reports and writing tests.  They may or may not participate in a bug hunt, but they will be happy to tell you where the critters live.  (Note: our spokesbug, Camelia, lives in our hearts.)

Druids are as one with the ecosystem, helping to take care of all of the little things that make the Perl 6 work together.  As such, they help take care of things like module installers and keeping our websites running.  They don't actually have a secret druidic alphabet -- it's just Unicode.

To be a druid, one needs lots of constitution to deal with the never-ending cycle of bugs, strength to wrangle with RT, and wisdom for the patience to accept the errors one cannot fix.

[Coke]++ is the leader of our druidic circle; he keeps Perl 6 implementations properly roasted.


Bards are free spirits who wander from place to place, working on whatever strikes their fancy.  The Bard dabbles in all aspects of Perl 6, but rarely into great depth.  For this, they are often described with the phrase "jack of all trades, master of none".

Bards are useful because they can jump in to assist where needed.  They can answer newbie questions like the Monk, implement a few language features like the Wizard, write small modules and applications like the Warrior, submit bug reports like a Priest, and bolster the courage of a community like a Healer.  Just don't expect a Bard to write the next killer app, resolve a heated discussion, or port NQP to a new VM without major help.

A major role of the Bard is that of story and song.  They spread tales far and wide of Perl 6 and it's heroes -- tales of Larry the Wise, Audrey the Great, Jonathan the Strong, Tobias the Bold, and Mäsak the Pretty Cool Guy.  But mostly, they should write about the language and its features in the most eloquent way possible, and share the knowledge through writing documentation and blogging.

Being a Bard requires charisma to communicate clearly and convincingly about the language, and dexterity to switch easily from one task to another.  But in general, they need balanced stats, so they can work in different areas.

I tend to consider myself a Bard, which is why I wrote this article.

All right chums, let's do this!

So I hope that you were entertained, because Perl is supposed to be -Ofun -- min/maxed for fun.  And after all of these years, it looks like we have a much greater than (97/3).Rat percent chance of succeeding. 

So if you'd like to participate, come and find a role that suits you in the Perl 6 community.  You'll earn XP (Extreme Programming skills) and piles of tuits!

Wednesday, April 3, 2013

Why I use Perl 6

I'm one of those mythical beasts that you've been hearing about for years but have never actually seen -- I am a Perl 6 user.  And much like the hidden Bigfoot of the northern forests, I'm kind of a lurker.  But I do exist, and the time has come for me, at long last, to delurk.

Why now?  The main reason for this is that there is finally an implementation that "just works", Rakudo.  Sure it's still too slow, but most of the dreaded "Not Yet Implemented" errors have faded away.  The module ecosystem is starting to pick up steam, even if it still tiny.

And, coding in P6 is fun.  While at it's heart, everything is an object, Perl doesn't force you into any one paradigm.  If you want to see if a variable is defined, you can use functional (defined $a), object-oriented ($a.defined), or even smart match against the defined property ($a ~~ :defined).  This philosophy runs throughout the language, yet everything works together seamlessly.

And when it comes down to it, Perl 6 is easy to look at.  I've even heard beginners say it was a "beautiful language".  This is not exactly Perl's reputation, but it's true.  Sure, you can still write obfuscated spaghetti code if you want -- we're not talking about Python here -- but it's easy to avoid doing so.  Regexes and grammars are actually readable now, and far more powerful than in Perl 5.  Backslash hell is gone.

Here's a quick example.  In bit of code I ported from Perl 5, I had to turn a path like "././foo/bar" to "foo/bar".  In Perl 5, we have this:
    $path =~ s|^(?:\./)+(?=[^/])||s;
Okay, a strange looking regular expression, but I've seen worse.  But now in Perl 6:
    $path ~~ s/^ './'+  <?before <![/]> >//;
The major difference is that you can tell what it does at a glance without first putting on your robe and regex wizard hat.

The end result is that when I see a piece of new Perl 6 code, it takes me very little time to figure out what it actually does.  I certainly can't even come close to that speed in grokking C++, and even Perl 5 seems like a storm of pointy arrows and curly braces when OOP is involved.

Finally, the community is amazing.  They're not a large group, but they are an active one.  Sometimes, you can report a bug, and it gets a patch 15 minutes later.  Other times it's joking about horse meat on the IRC channel.  But always, they're welcoming to newcomers, encouraging people to play around, send in bug reports, and write code.  They're the kind of people who make one want to delurk.

Perl 6 is powerful, easy to read, adapts to your style, has a friendly community, and most importantly is fun.  Even if it's not "done", I got tired of waiting for Christmas and opened my presents early.  And inside, I found a perfectly usable language.