Thomas 'PointedEars' Lahn napisal(a):
Luke Matuszewski wrote:
JavaScript is generally interpreted language, [...]
It is not, otherwise it would be too slow for the Web. It is compiled (in
browsers: JIT-compiled)
You are saying that JavaScript is not interpreted language and then you
states that:
resulting byte-code is interpreted by aVirtual Machine.
In all ECMAScript specs there is NO SUGGESTION on how JavaScript
programs are executed (not a word about Garbage Collector and
JavaScript Virtual Machine). The implementation decides what format and
how it will be executed later.
I mentioned also '''''generally'''' because there is no restriction it
would not be interpreted.
Implementation may decide to produce .exe (PE format file) or .bin (ELF
format file) as a result of compilation, or bytecode to be run on
implementation dependen JSVM (because in specs there is not a word
about format of bytecode, JIT or Hot Swap techniques and other things
like garbage collector algorithms used) but generally there is no need
to. Another case is Java Virtual Machine, which is described in Sun
Specs with Byte Code format - because Java Byte Code is required to run
on platform which has Java Runtime Envirnoment.
As a case of SpiderMonkey - there is no JSVM there - it is embedded
using shared library (or if needed statically linked in C code).
[
http://developer.mozilla.org/en/docs...der%27s_Guide]
<quote>
The engine handles memory allocation for the JS data types and objects
needed to execute scripts, and it cleans up -- garbage collects -- the
data types and objects in memory that it no longer needs.
How Do You Use the Engine?
Generally, you build the JS engine as a shared resource. For example,
the engine is a DLL on Windows and Windows NT, and a shared library on
Unix. Then you link your application to it, and embed JS engine
application programming interface (API) calls in your application.
</quote>
As a result personally i think that Rhino is far more easier to use at
hoc than SpiderMonkey (Rhino only requires the Java Runtime Envirnoment
and nothing else).
BR.
Luke.