可以使用JavaScript中的谷歌浏览器(V8)时,被认为是一个跨preTED语言? [英] Can Javascript be considered a interpreted language when using Google Chrome (V8)?

查看:192
本文介绍了可以使用JavaScript中的谷歌浏览器(V8)时,被认为是一个跨preTED语言?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在读V8上,谷歌的Javascript引擎这个优秀的文章:<一href=\"https://developers.google.com/v8/design#mach_$c$c\">https://developers.google.com/v8/design#mach_$c$c.

在一个点

,他们说,JavaScript是直接编译成机器语言,没有任何一个字节code或跨preTER。

要报价:


  

V8直接编译JavaScript源$ C ​​$ C成机器code时,
  首先执行。有没有中间字节codeS,没有
  除preTER。


那么,为什么仍然使用Javascript的脚本和跨preTED的语言,当它显然是编译一起列出(在V8中,至少)?





修改我莫名其妙地创建可执行出来的Javascript,如果编译?这就需要以某种方式将其链接到V8?

考虑这个问题,我发现这句话:


  

V8可以独立运行,也可以嵌入到任何C ++应用程序。


下面: HTTP://$c$c.google.com/p/v8/


解决方案

这是为什么除preTED语言和编译语言是马虎术语的例子。无论是语言编译或间preTED是一个属性的的实施的,而不是语言本身。

很多人混淆了跨preTED和静态类型语言和编译,动态类型语言(如JavaScript),但这些仅仅是相关关系,而不是绝对的。它可以编译动态语言(尽管它通常比编译静态的麻烦),并有可能跨preT静态语言(例如:拥抱是哈斯克尔跨preTER)

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/.

解决方案

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).

这篇关于可以使用JavaScript中的谷歌浏览器(V8)时,被认为是一个跨preTED语言?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆