So am I to take it that the interpreted part is a requirement in the language specification, or is it misleading to say that the language is an interpreted programming language when respecting the difference between a language and its many implementations?
I fanatici del linguaggio EcmaScript usano spesso il termine "interprete ES" per riferirsi a un'implementazione di EcmaScript, ma la specifica non usa quel termine. La panoramica della lingua in particolare descrive la lingua in termini indipendenti dall'interprete:
ECMAScript is object-based: basic language and host facilities are provided by objects, and an ECMAScript program is a cluster of communicating objects.
Quindi EcmaScript presuppone un "ambiente host" che è definito come un fornitore di definizioni di oggetti che includono tutti quelli che consentono l'I / O o altri collegamenti al mondo esterno, ma non richiede un interprete.
La semantica delle affermazioni ed espressioni nella lingua è definita in termini di specifiche di completamento che sono banalmente implementate in un interprete, ma le specifiche non lo richiedono.
8.9 The Completion Specification Type
The Completion type is used to explain the behaviour of statements (break
, continue
, return
and throw
) that perform nonlocal transfers of control. Values of the Completion type are triples of the form (type, value, target), where type is one of normal, break, continue, return, or throw, value is any ECMAScript language value or empty, and target is any ECMAScript identifier or empty.
The term “abrupt completion” refers to any completion with a type other than normal.
I trasferimenti di controllo non locali possono essere convertiti in array di istruzioni con salti che consentono la compilazione di codice nativo o byte.
"EcmaScript Engine" potrebbe essere un modo migliore per esprimere la stessa idea.
There are no static compilers for JavaScript apparently
Questo non è vero. L'interprete V8 compila internamente il codice nativo, Rhino compila facoltativamente in bytecode Java internamente, e vari interpreti Mozilla ({Trace, Spider, Jager} Monkey usano un compilatore JIT.
V8 :
V8 increases performance by compiling JavaScript to native machine code before executing it, versus executing bytecode or interpreting it.
Rhino :
public final void setOptimizationLevel(int optimizationLevel)
Set the current optimization level.
The optimization level is expected to be an integer between -1 and 9. Any negative values will be interpreted as -1, and any values greater than 9 will be interpreted as 9. An optimization level of -1 indicates that interpretive mode will always be used. Levels 0 through 9 indicate that class files may be generated. Higher optimization levels trade off compile time performance for runtime performance. The optimizer level can't be set greater than -1 if the optimizer package doesn't exist at run time.
TraceMonkey :
TraceMonkey adds native‐code compilation to Mozilla’s JavaScript® engine (known as “SpiderMonkey”). It is based on a technique developed at UC Irvine called “trace trees”, and building on code and ideas shared with the Tamarin Tracing project. The net result is a massive speed increase both in the browser chrome and Web‐page content.