the.weavster wrote:So we categorically know that V8 is not an interpreter, it compiles JavaScript to machine code, we've got that direct from Google's developers. So once V8 has compiled the JavaScript to machine code we have machine code, we have the JVM and we have the JNI.
Yes; and the JVM and JNI are only pertinent insofar as Java development is concerned.
the.weavster wrote:So where is the "JavaScript engine [that] acts as an interpreter to the Java environment"? Who made it, what's it called and why do we need it?
Fair questions. I'll address them in three parts.
1. The compiled codes of the V8 JavaScript engine execute independently only when run through an instance or a context of its integrated web browser.
2. In all other cases, they are compiled only as shared objects that would be linked to the code of other languages, to be called and executed therefrom.
3. It's the same with Java, but since their code has to run on their platform-dependent JVMs, the JNI is also required.
And lastly, let's not lose sight of the topic that sparked off this discussion;
DroidScript. On the Android platform, instead of the JVM, the DVM is utilised. This VM is integral to any app, meaning that no code could be executed without being run through it
(with the exception of web apps and the experimental ART model).
Even with the V8 engine, this Android model renders it impossible for DroidScript apps from being compiled to machine code for direct execution; they still have to be run through the DVM.
So, since the JavaScript engine generates this specific object-model code in order to be utilised by these other languages,
it technically acts as an interpreter to their programming environments, Java included.
This has been my sole contention all the while, although I'm not expecting your consensus on the matter.
I've elaborated my position for the benefit of other readers whom I hope would find it useful.
Additionally, if there's been any perceived abrasion on my part that has caused yours, my apologies.
Sincerely. In all honesty, I usually restrict my comments to the contents of the posts, and not to the poster. But in light of the continuous bombardment of personal attacks thrown my way, the gloves just came off.
Only human, right.
