犀牛与蜘蛛猴 [英] rhino vs spidermonkey

查看:99
本文介绍了犀牛与蜘蛛猴的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到ubuntu 10.04删除了spidermonkey软件包. Rhino看起来仍然在那里.犀牛和蜘蛛猴之间有什么区别(除了它们使用的是哪种语言).为什么他们要删除蜘蛛猴?

I noticed ubuntu 10.04 removed the spidermonkey package. Rhino looks like it's still there though. What are the differences between rhino and spidermonkey (besides what language they're written in). And why did they remove spidermonkey?

推荐答案

恐怕它们的语言不同或含义不同.人们使用C/C ++编写各种形式的事物(例如Firefox),而Java在Application Server中最为普遍.来自 http://en.wikipedia.org/wiki/Rhino_%28JavaScript_engine%29:

I'm afraid the difference is the language they are written in, or what it means. People use C/C++ to write all manner of things (like Firefox) whereas Java is most prevalent in Application Servers. From http://en.wikipedia.org/wiki/Rhino_%28JavaScript_engine%29:

Rhino将JavaScript脚本转换为 Java类.犀牛在这两者中都可以工作 编译以及解释模式. 它旨在用于 服务器端应用程序,因此 对浏览器没有内置支持 通常关联的对象 使用JavaScript.

Rhino converts JavaScript scripts into Java classes. Rhino works in both compiled as well as interpreted mode. It is intended to be used in server-side applications, hence there is no built-in support for the browser objects that are commonly associated with JavaScript.

这里有三个重要部分.首先,没有DOM(SpiderMonkey也是如此).其次,服务器端是预期用途.您应该能够在大型企业级应用程序中使用Rhino,以更加临时的方式自动执行操作.最后,Javascript成为一个类,就像其余的Java类层次结构一样,您可以与Java类进行交互(请参阅该页面上的代码示例).

There are three important parts here. Firstly, there's no DOM (also true of SpiderMonkey). Secondly, server side is the intended usage. You're supposed to be able to use Rhino in your big enterprise-y application for automating stuff on a more ad-hoc basis. Finally, the Javascript becomes a class just like the rest of the Java class hierarchy and you can interact with Java classes (see the code sample on that page).

简而言之,您可以很轻松地操作POJO/基于JPA的对象/消息Bean/任何您想调用企业" Java类的东西,而所有这些都可以通过运行Rhino的javascript实现.将此与Jython进行比较,您可以在其中使用Python语法和类与Java进行交互.如果您有一些JavaScript/Python狂风在办公室四处闲逛,则非常方便.

In short, you could quite easily manipulate your POJOs/JPA-based objects/Message Beans/whatever you want to call your "enterprise" Java class, all from within a javascript run through Rhino. Compare this to Jython, where you can use Python syntax and classes to interact with Java. Handy if you have some JavaScript/Python whizzes kicking around the office with nothing to do.

SpiderMonkey更像LUA.这是一种脚本语言.有什么不同?好吧,我怀疑您可以直接访问printf.不能直接访问Java类,而不能直接访问C/C ++类.而是使用C/C ++对语言的其他功能进行编程.

SpiderMonkey by contrast is more like LUA. It's a scripting language. What's the difference? Well, I doubt you get access to printf directly, for one. Rather than being able to access Java classes straight off, you don't get to access C/C++ classes straight off. Rather, you use C/C++ to program extra features of the language.

简而言之,Rhino允许JS与您的代码进行交互. SpiderMonkey更像是一个自己动手的编译器套件,具有更多的优势,即已经建立了许多人都知道的标准语言,而您只需要在其中添加自定义项即可.

In short, Rhino allows JS to interact with your code. SpiderMonkey is more like a do-it-yourself compiler kit with the added advantage that a standard language a lot of people know has already been built and you just need to add your customisations to it.

这篇关于犀牛与蜘蛛猴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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