== Rhino ==

Rhino is a high-quality Javascript engine implemented in Java with extensive API for embedding and management.

=== Porting Rails to Javascript/Rhino ===

Steve Yegge of Google gave a talk called "Google Rails Clone" where, as John Lam reports, he talked about his experience porting Ruby on Rails to Javascript at Google:

In an effort to increase developer productivity at Google, Steve tried to convince the company to adopt Rails (and consequently Ruby) as a programming language. When that fell on deaf ears (Google really does not want to increase the number of languages that must be supported by their infrastructure), Steve decided to do what any other frustrated programmer would do: he ported Rails to JavaScript. Line by line.

This is clearly something that caught the interest of the software development community, with reactions that run the gamut. The effort reminded some of other projects, particularly TrimPath Junction, another attempt to reproduce Ruby on Rails in Javascript, but also Phobos and Helma. Many saw this as confirmation that Yegge's Next Big Language is Javascript or ECMAScript, and made reference to Steve's recent Marshmallow and Rich Programmer Food posts. Some pondered the connection to .NET on Rails, and some questioned the effort.  Steve has since updated his blog with more details.

Between the choice of JVM languages, Steve Yegge describes the choice between Java, Jython and Rhino:

Looking at the Rails APIs, which typically pass around hash literals as parameters, it didn't seem like Java was going to be a particularly good match. Ruby has no method overloading, and both Ruby and Rails have all sorts of conventions for passing varargs or block (function) parameters. Java's different enough from Ruby that the impedance mismatch might have killed the effort, so I decided to stick with a dynamic language.

Jython seemed like the obvious choice at first, except that it hasn't had much momentum since around 2001. It used to be arguably the best non-Java JVM language around; Jim Hugunin did an amazing job with it. Unfortunately it's had almost no love in the past six years, and it's now lagging the Python spec by several major versions (2.2 vs. soon-to-be 2.6).

Rhino, in contrast, has a great deal of momentum. It's been around even longer than Jython; it began life as a port of the SpiderMonkey (Netscape/Mozilla) JavaScript C engine, and it was written with an eye for performance. The Rhino code base reads almost like C code: it avoids allocation and does as much as possible with jump tables to avoid the overhead of virtual method lookups. It has two code paths: a bytecode interpreter that runs in a tight loop, and an optimizing Java bytecode compiler that turns many expensive-ish JavaScript property lookups into Java local or instance-variable lookups. It's a pretty serious piece of software.

 See Also::
 * [[http://www.infoq.com/news/2007/06/yegge-rhino-on-rails|Steve Yegge Ports Rails to Javascript/Rhino]], Info``Q
 * [[http://ajaxian.com/archives/rhino-on-rails-javascript-mvc-on-the-server|Rhino on Rails: JavaScript MVC on the server]] interview with Steve Yegge; video
 * [[http://steve-yegge.blogspot.com/2007/06/rhino-on-rails.html|Rhino on Rails]], Stevey's Blog Rants
