Tonight I had chance interview Flávio Soibelmann Glock (aka: "fglock") about the status of the 'v6', the project to get Perl 6 run on Perl 5, and eventually to have Perl 6 run on Perl 6. Read on for the interview.
Nearly every day I see commits go by for your work on v6. I know it relates to running Perl 6 on Perl 5. Could you provide a quick overview of the major parts?
The "v6-Compiler" module (v6/v6-Compiler) is the final goal of this project. It implements Perl 6 using Perl 6.
"v6.pm" is a bootstrapping compiler (perl5/Pugs-Compiler-Perl6). This means that v6.pm is used to compile the Perl 6 compiler, before it can compile itself.
v6.pm uses several CPAN modules: Pugs::Compiler::Rule (regexes), Data::Bind (signatures), Moose (objects), Parse::Yapp (precedence parser).
How functional is it at this stage?
It currently passes about 10% of the Perl 6 test suite. It provides the language basics: statements, expressions, and classes. It also has regexes and grammars, which are needed in order to write a compiler.
Several parts of the compiler are written in Perl 6 - these parts are compiled using v6.pm itself. The grammar in the Pugs::Compiler::Rule module in CPAN is written in Perl 6 and compiled to Perl 5 using v6.pm.
How's the performance?
It compiles about 100 lines per second. The code is cached - it only compiles once.
The generated code is reasonably optimized - and it runs at perl5 speed.
What are your goals for the project? Do you see it as an eventually viable Perl 6 implementation?
v6.pm goal is to be able to compile the "real" v6-Compiler (p6-on-p6). However, since v6.pm must be "correct enough" and "fast enough", it can be used for writing general purpose modules or programs too.
Briefly explain the role of the ".pmc" file that are used.
The ".pmc" is used as a perl5 cache file. When perl5 finds both a ".pm" and a ".pmc" files, it chooses to execute the ".pmc".
When v6.pm compiles a ".pm" file, it dumps the perl5 code to a ".pmc". Next time, perl5 will just load the compiled version. This is very fast.
Does the v6 project bring benefits for people who continue to program primarily in Perl 5, or it is targeted more at people who want to try Perl 6?
I think the main benefit is that it reassures perl5 programmers that Perl 5 is compatible with Perl 6 - two way compatible, even.
Perl5 programmers can use the infrastructure modules directly - Moose, and Pugs::Compiler::Rule - v6.pm is just the "syntax layer".
Is there any part of Perl 6 that you see as impossible to implement this way?
Some perl6 features might be slow in perl5 - like coroutines, but not impossible.
What's the easiest way to try out v6?
You can install "v6" from CPAN. It will load all the dependencies automatically.
Some modules like PadWalker and Data::Bind require a C compiler. Windows users can use the vanilla-perl distribution, which comes with a C compiler.
What's a good way for people to get involved if they would like to learn more about v6 or help with this project?
Being around in the #perl6 channel on freenode is a good way to start.
Hmm, ActivePerl 5.8.x + MSVC also works for PadWalker, Data::Bind and thus v6.pm. :)
Posted by: agent | 2006.09.15 at 01:34 PM
I am amazed by all the nice work from you guys.
Posted by: Daniel | 2006.09.23 at 12:43 AM
Currently only a few compiler components are reusable between implementations, but we are working on it.
The shared AST format will most likely happen when we get Perl6-in-Perl6 working, because this will allow the same compiler to run in several backends.
Posted by: fglock | 2006.09.26 at 11:27 AM
Thanks for the answer!
Posted by: Daniel | 2006.09.26 at 08:10 PM