I started writing this as a response to chromatic's post at his Modern Perl blog. Short version: I think that the VM will be no problem for Moe, Stevan Little's new project to bring a Perl (or dialect) to the JVM.

Overall, I think chromatic's points are very good, and I agree with many of them, especially in the "What Moe Could Produce" section.

But I disagree with one point, in that the JVM has (at least to me) proven that it is an excellent platform for hosting dynamic languages. Well, at least one dynamic language.





I spent a year porting Perl 5 code to Clojure. The first phase of the port was (more or less) a bug-for-bug reimplementation of the architecture of our product, including porting a *lot* of the functionality of Catalyst, and some of Moose.

Doing it this way allowed for some good comparisons to be made between the languages. For example, the Clojure code, overall, wasn't really any more or less readable than it was in Perl, nor was it much easier or harder to "grok". Changing the language and VM while keeping the same overall design didn't make the product any more scalable, and not a *whole* lot more robust, but one thing stood out for me - it was faster.

a lot faster

And yet, IMO, we didn't lose much at all in the way of flexibility, as the Clojure language, despite being Yet Another Lisp Dialect(tm), is actually quite pleasant to work in. Syntax aside, I felt it had a lot in common with Perl, and found that just about any technique or trick I might want in Perl 5 was either available to me or was unnecessary due to the availability of alternatives. Built-in anonymous lists, arrays, and hashes with a concise syntax to use and define them? Check. (in fact, it's '() [] and {}, respectively, with the contents inside the delimiters). Mutability of atoms, data-structures, and objects? Not by default, but you can make them. Even the "object system" has a lot in common with Perl 5. Introspection of *everything*? Symbol-table hacking galore? All that and much more. A very nice toolchain that automates nearly all the drudgery and headaches? Check. Full compatibility and integration with code written in other languages running on the JVM? Wonderfully done. We even added a macro so that regexes felt more like a built-in feature rather than a library.

Only thing missing is an analogue to the CPAN. And I heard that's being worked on...

Compared to Perl, I might complain that Clojure is completely unsuitable for command-line programs. Of course, that's not what Clojure is currently used for (I love leiningen as a build and dependency tool. I *hate* waiting for it to start up...)

Bottom line, I believe that the JVM can handle just about any dynamic language or language construct you throw at it, it's just not suitable for "scripts".

(unless you keep a persistent JVM instance or use something like drip and even then, that seems to me to be a lot of overhead just for scripting)

Anyhow, while I don't agree that Perl is "dead", both Stevan and chromatic make excellent points in their recent talks and posts, and I heartily support any effort that might produce a usable variant of Perl 5 on another VM. I especially think that targeting the JVM is an excellent choice. I've seen a little Scala code, and I think this may just be what I need to start really learning it. That and the fact that some people at my current $work are beginning to use it. I think Moe is feasible. Whether or not it has a shot will depend partially on the community that forms around it, partially on how good and easy whatever "CPAN" might arise is, and partially on how long it takes to get to "production-ready" status.

But that's a topic for another post, and all I have are opinions with nothing real to back them up, which are the kind I tend to keep to myself.



As an aside, a notable issue with Clojure is the density and near-uselessness of the the stack-traces. Nearly as dense as C++ compiler errors with a dozen nested templates and almost as useless as Python stack traces in a Twisted application. Clojure's exception dumps make Moose's dumps look sane. I suspect this is because of Clojure's dynamic nature combined with the backflips needed to make it all work on the JVM, but regardless, it still works wonderfully.