All about Perl 6 – interview of Moritz Lenz
We set to explore Perl 6’s key language elements and at the same time get behind the scenes of the underlying infrastructure provided by its two implementations, Rakudo and Niecza.
In this first part of the series we interview Moritz Lenz about Rakudo, Perl 6’s implementation on the Parrot VM,
while we also establish the relationship between Perl 5 and Perl 6 and examine where they differ.
Moritz is a Physicist from Germany who fell in love with Perl from an early age, a regular contributor to the Rakudo compiler as well as an acknowledged member of the People of Perl 6 club.
His great experience and knowledge in Perl 6’s internals will allow us to take a deep look into the language and discover its potential, merits and reasons to try it out!
NV: Recently you went to a town called Perl for a meeting about unification of the Perl 5 and Perl 6 communities. Are the Perl5 and Perl6 two distinct communities or do they overlap?
ML: There is a certain overlap. For example p5 and p6 folks go to the same conferences, workshops, hackathons but many Perl 5 core developers ignore Perl 6 and while most Perl 6 core hackers roughly know what’s going on in Perl 5 land, there had been a big lack of communication.
NV: Is that true of the languages as well? I mean are Perl 5 and Perl 6 two distinct languages, or will past experience of Perl 5 make adoption of Perl 6 easier?
ML: They are distinct languages from the same family of languages. On the surface they look quite similar and they are designed using the same principles:
- easy to learn (it’s possible to speak “baby perl” without learning much of the language)
- get things done quickly
- there’s more than one way to do it
On the other hand they are different enough that a Perl 5 program doesn’t run on a Perl 6 compiler, or vice versa and different enough that automatic translation from one to the other is quite challenging. So if you know Perl 5, Perl 6 feels familiar, but under the hood a lot has changed.
For example, Perl 6 is object oriented to the core, where Perl 5 is not.
NV: Why switch to Perl 6, what does it offer to programmers, i.e what features stand up in a programming end-level? Is there a niche field that it really shines in?
ML: First, it supports both object-oriented and functional programming styles really well and then it has lots of features that no other language has combined before.
For example, Perl 6 has lazy lists, which are usually only found in pure functional languages, and it offers a meta object system, which means you can create your own object types (like classes, roles, enumerations).
Also, its function signatures are powerful enough to compete with the pattern matching facilities you might know from functional languages like Haskell. And the nice thing is that you don’t have to know all those fancy features to get started — you can write well-readable Perl 6 code with basic knowledge, but an experienced programmer can use all the “power” features.
Oh, and it is dynamically typed, but you can chose to add type annotations, and profit from enhanced speed and safety where you do
NV: For people that have experience in other classic or static OOP languages, Roles can be used to construct Interfaces, Abstract classes, as well composition over inheritance?
ML: Right, you can use them both for interfaces as you know them from Java, and for code reuse, where they detect method conflicts at compile time, which multiple inheritance usually does not.
NV: What does Parrot offer a language implementer? Better parsing facilities or out of the box ones like a GC or JIT?
ML: It has a pretty good GC and there’s a compiler toolkit, which makes it quite easy to parse languages, and generate parrot’s assembler code from it. It also offers pretty good abstraction of OS-specific features and it lets you write extensions in C. For example, Rakudo uses a custom dispatcher for multi-dispatch and has several custom opcodes to speed up hot paths.
NV: Are you concerned that Parrot is too tightly related to Perl 6 and therefore doesn’t get that much attention from other dynamic languages?
ML: No. That was Allison Randall’s concern, when she was Architect of the Parrot VM. In the end it didn’t really attract developers from other dynamic languages, but made life harder for the Rakudo developers.
NV: In the end what would you tell aspiring language implementers so as to lure them into Parrot instead of them opting for another VM like .NET?
Look at the Squaak tutorial (http://en.wikibooks.org/wiki/Parrot_Virtual_Machine/Squaak_Tutorial) and see if you’d like to develop your compiler like this. If yes, chose Parrot.
For the full interview please follow :
Nikos Vaggalis has a BSc in Computer Science and a MSc in Interactive Multimedia. He works as a Software Engineer/Database Application Developer and codes in Perl and C#.