Nashorn works in real life

Tal Liron tal.liron at threecrickets.com
Wed Oct 9 10:33:01 PDT 2013


After reporting various bugs and complaints on the list, I have some 
good news for a change. :)

The complete Prudence stack, which includes a *lot* of JavaScript code 
developed for years to work in Rhino, now runs perfectly fine on 
Nashorn. (The exact same code base also works in Rhino.)

Prudence is a powerful REST and web platform. With it, you can use 
JavaScript (as well as many other JVM languages) to write RESTful 
resources and dynamically generated, cached web pages.

I hope this will allow you to test Nashorn performance in server-side 
environments, and to compare it with Rhino in this respect, too.

Nashorn is now a fully supported language in Scripturian (an alternative 
to JSR-223), so any other applications that use Scripturian can also now 
leverage Nashorn. I should point out that Scripturian also works with 
the nashorn-backport project, so the whole stack can work on JVM 7.

I did need some hacks:

1. I patched Nashorn for the "NPE in DebugLogger.levelAbove" bug I reported.
2. I patched mozilla_compat to support multiple arguments in importClass 
(again, as with the bug I reported).
3. I had to implement a rather ugly hack in Sincerity to deal with 
Nashorn's current inability to coerce string arrays (I actually do a 
string.split(",")...), and also moved a static method to become 
non-static for the sake of Nashorn's strictness. Sigh.

(And also some other small JavaScript changes that work fine in Rhino, too.)

I would also love for Diligence to run on Nashorn: Diligence is a 
full-blown server-side JavaScript web framework built on Prudence and 
MongoDB. However, this would require more work, because the 
JVM/JavaScript MongoDB driver I wrote is currently Rhino-specific. I 
will update you in the future on this progress, as it would allow for 
even more avenues for testing.

Keep up the good work! And hopefully listen to my advice on how to move 
Nashorn forward: I speak from quite a bit of experience with dynamic 
languages on the JVM, and JavaScript especially.

-Tal


More information about the nashorn-dev mailing list