Thursday, August 04, 2005

I want a ponie...

I'm sitting listen to Nick Clark talk about Ponie, the project to allow us to run Perl 5 programs on top of Parrot, the virtual machine designed for Perl 6.

Perl 6 is a language and Parrot the virtual machine, whereas Perl 5 is both a language and a virtual machine. So we want to be able to write and run Perl 6 code, and run our existing Perl 5 and XS code linking to external libraries. In other words we want to be able to call from one virtual machine into another. We already have Inline, so why not just use that? It's not impossible, although it might mean some changes were needed to the Perl 5 internals. But it's not the best approach...

We need one single virtual machine, so can we compile Perl 6 down to Perl 5? Difficult, both threads and Unicode were bolted on to Perl 5 almost as an after thought and we want them to work well in Perl 6. How about compiling Perl 5 to Perl 6? This will almost certainly give us problems with existing XS code. So is there another way...?

There is only one Perl implementation, and the documentation might not specify behaviour. In reality the Perl 5 language is defined by the C source, with lots of corner cases. We need to present to all the Perl 5 code the illusion that it's running on the Perl 5 virtual machine, when it's actually running on Parrot.

This is what Ponie is all about...