...composed of an indefinite, perhaps infinite number of hexagonal galleries...

© 1994-2017. David Sklar. All rights reserved.

Virtual Machine War

Last week at php-con was subtle, preliminary skirmish in the upcoming Virtual Machine War. The contenders are Parrot, whose language-in-chief is Perl 6, and the CLR, whose patron language is C#.

If this were just a language battle of Perl 6 vs. C#, it wouldn’t merit any more notice than any other matchup in the perpetual linguistic conflict that is constant among programmers. What sets this face-off apart is that each of these VMs can host other languages as well. Running on top of Parrot, Python code can use Perl libraries and vice versa. Running on top of the CLR, C#, J#, Visual Basic.NET code can perform similar feats of reuse.

Rarely are functions in the standard C library reimplemented in systems programming. This kind of wheel-reinvention happens all the time in web apps, however. The multi-language capabilities of Parrot and the CLR provide the opportunity for each system to have a “libc for the web” that handles standard functionality: handling form and URL data, serving and consuming web services, processing XML, and all of the other tasks that make up the plumbing of web applications. No matter what language you write your application in, you can use the same core library functions. If knowing a language’s library APIs is as crucial as knowing a language’s syntax, a common core library makes you productive in new languages much more quickly.

Microsoft’s ASP.NET libraries, also implemented for Mono are a shot at the prize. There is plenty of code in CPAN that, converted to Perl 6, could also be a contender.

So why was php-con a skirmish? The talk by Sterling Hughes and Thies Arntzen about their plans to build a PHP-to-Parrot compiler tug the future of PHP towards Parrot. But there’s also an existing project to build PHP#, a version of PHP that runs on the CLR. (Memo to Microsoft: hire Alan Knowles and/or anyone else you can get your hands on to make PHP# a reality if you want to win this battle.) Brian Goldfarb, a Product Manager from Microsoft, came to PHP-Con to learn from folks there.

Microsoft was blindsided by Linux and now is attempting to avoid their mistakes in the world of scripting languages and PHP. With little to no commercial backing, PHP has become an incredibly popular on-ramp to small-time web developers. That’s supposed to be Visual Basic’s niche. So maybe by understanding PHP, Microsoft can compete better in that world.

There is a lot going on that makes the outcome of this titan clash still unclear. ActiveState is working on Perl for .NET. The .NET development model is tightly integrated with Visual Studio, which is designed with languages like Visual Basic and C# in mind, so day-to-day comfort of application development doesn’t yet quite sync with the technical possibility of running other languages on the CLR. The CLR and Mono are available now, while Perl 6 is not. PHP 5 is on the way (“before Perl 6” I think is the target release date) and plenty of people will stick with PHP 4, let alone move from PHP 5 to a future Parrot/CLR based version of PHP in a few years. IIS and Windows are tuned to provide the best operating environment for .NET – what kind of tight integration will be developed between Apache, Linux, and Mono or Parrot?

Oh yeah, Java is still around, right? Visual J# seems focused on migrating developers away from Java and I don’t expect a version of Java for Parrot (but open-source developers have built all sorts of crazy projects). Both Parrot and the CLR have learned from the Java VM’s host-only-one-language mistake. Given the $zillions invested Java deployments to date, I suppose Java’s not disappearing any time soon, but Sun needs to work on how to stay relevant in the multi-language VM world of the near future.

Tagged with software