The Tower of Perl

by Simon Cozens

Have you ever played a game called Jenga? The idea behind Jenga is that
you start by making a tower of blocks. Each player removes a block from
somewhere in the tower, and moves it to the top of the tower. The top of
the tower looks tidy, but it's very heavy and the bottom of the tower is
growing more and more unstable. Eventually, someone's going to take away
a block from the bottom and it'll all fall down.


I came into Perl development quite late, and I saw a very intricate,
delicate interplay of ideas inside the Perl sources. It amazed me how
people could create a structure so complex and so clever, but which
worked so well. It was only much later that I realised that what I was
seeing was not a delicate and intricate structure but the bottom end of
a tower of Jenga. For example, fields in structures that ostensibly
meant one things were reused for completely unrelated purposes, the equivalent of taking blocks from the bottom and putting them on the top.


One man's elegance is another man's collection of dirty hacks - the
reason the tower of Perl's source code looked as intricate as a paper
doily was because, like the doily and like the Jenga tower, it was full
of holes! New advancements in Perl meant that the tower climbed ever
higher, but at cost of stability to the base of the tower.


Pseudohashes were pretty much the last straw. When pseudohashes were
implemented, a whole heap of blocks were taken from the very bottom of
the tower and dumped rudely on the top. Unsurprisingly, the whole
structure got top-heavy, more unstable and more difficult to manage.
Thankfully, unlike the game, we as Perl developers can take the bricks
back and put them where they were - pseudohashes are being excised from
the Perl core.


But as we progress in our development and add shiny new things to the
top of Perl's tower, we're making the bottom more unwieldy. One of these
days, at least some part - if not all - of the tower is going to collapse.


This is why we need Perl 6. We now know what our tower should look like,
and we need to build it from that design right from the start.