Oracle Proposes New Native JavaScript Engine for OpenJDK
hypnosec writes "Oracle has proposed a new project for OpenJDK — Nashorn, which aims to implement a high-performance yet lightweight JavaScript runtime that would run on the JVM natively. Nashorn will be headed by Jim Laskey, multi-language Lead at Oracle and the project will be sponsored by HotSpot group. The project proposes an implementation of JavaScript such that it can run standalone JavaScript applications via the JSR 223 APIs. Nashorn's design will enable it to take advantage of new JVM technologies like the MethodHandles and the InvokeDynamic APIs."
Now this will just make describing the differences between java and javascript even more painful . . . :P
I read TFA and all I got was this lousy cookie
There have also been standalone javascript engines running on the JVM; the best-developed is Rhino from Mozilla.
10 PRINT CHR$(205.5+RND(1)); : GOTO 10
This was first discussed in July 2011 at the JVM Language Summit (PDF) link. It was discussed at the most recent JavaOne, and there have been more than a few articles about it.
What do you know I wrote a novel
Thought people should know
As the actual proposal notes, while Project Nashorn has been in the works within Oracle for some time, what they're doing now is proposing to make it part of OpenJDK, to get more people working on it so that the code can be tightened up for production use.
Breakfast served all day!
If you mean JSON; YAML (1.2 and up) is a superset of JSON.
I don't think you mean actual JavaScript in a configuration file and eval-ing that....
Perl Programmer for hire
Rhino has been a part of the default Java distro since long before v8.
What I'd like to know is, how does this thing improve on Rhino? And can parts of it be reused in scripting engines for other languages? The article is pretty light on details.
I do mean Javascript. Something like this:
It is similar to JSON, but notice the init function. This example creates a new Java (not Javascript) Car object, sets its driver and color attributes and starts the car when the application starts and stops it when the applicaton stops.
If in your particular configuration there are many such cars, than you are free to define your own Javascript function which can be used as a shortcut:
The administrator is allowed to bend the configuration syntax to his situation. And this power is almost free, the integration between Java and Javascript only requires a few lines of code in the application. For example you do not need to modify the source code of Car in the above example.
Node.js uses Google's V8 Javascript engine which is too fast for some applications. Also, it doesn't use enough memory, a problem the JVM is likely to correct. You can't expect much from an app that fails to allocate 900MB of virtual space and an 60MB working set on start-up.
Lurking at the bottom of the gravity well, getting old