Search code examples
javascriptgoogle-chromebrowserv8interpreted-language

Can Javascript be considered a interpreted language when using Google Chrome (V8)?


I was reading this excellent article on V8, Google's Javascript engine: https://developers.google.com/v8/design#mach_code.

At one point, they say that Javascript is compiled directly into machine language, without any bytecode or an interpreter.

To quote:

V8 compiles JavaScript source code directly into machine code when it is first executed. There are no intermediate byte codes, no interpreter.

So, why is Javascript still listed along with the "scripting" and "interpreted" languages, when it is clearly compiled (in V8, at least)?



Edit: can I somehow create an executable out of Javascript, if it is compiled? That would require somehow linking it to V8?

Considering that question, I found this quote:

V8 can run standalone, or can be embedded into any C++ application.

Here: http://code.google.com/p/v8/.


Solution

  • This is why "interpreted language" and "compiled language" are examples of sloppy terminology. Whether a language is compiled or interpreted is an attribute of an implementation, not of the language itself.

    Many people confuse "dynamically typed languages" (like JavaScript) with "interpreted" and "statically typed language" with "compiled", but these are merely correlations rather than absolutes. It is possible to compile a dynamic language (although it's generally trickier than compiling a static one), and it's possible to interpret a static language (eg: Hugs is an interpreter for Haskell).