为什么 JVM 应用程序不使用 Rhino?

发布于 2024-09-10 09:03:12 字数 318 浏览 5 评论 0原文

我想使用简洁的动态语言为 JVM 开发一些应用程序。最流行的选择似乎是 Jython、JRuby、Groovy,也许还有 Clojure。

Rhino看起来速度很快而且很稳定,但是我没有看到任何关于Rhino开发的书籍,也很少有讨论。为什么除了嵌入式脚本之外,JavaScript 显然很少被使用?

编辑:我发现这个问题提供了有关基于Rhino的可行性的信息发展。

I would like to develop some apps for the JVM using a concise, dynamic language. The most popular choices for this seem to be Jython, JRuby, Groovy, and maybe Clojure.

Rhino appears to be fast and very stable, but I see no books on Rhino development and little discussion. Why is there apparently little use of JavaScript for other than embedded scripting?

Edit: I found this question informative on the viability of Rhino-based development.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

岁吢 2024-09-17 09:03:12

我使用 Rhino 作为用 Java 编写并在 JVM 上运行的生产级 VoiceXML 解释器的一部分。它对于这个目的非常有效。如果我从头开始重新实现这个解释器,我会倾向于用 JavaScript 进行更多的开发。所以这绝对是一个选择。您需要探索周围的库对于您的应用程序领域来说有多成熟(您始终可以编写从 JavaScript 调用到 Java 库的逻辑,但这可能太费力)。

但我也同意 @Peter Recore 的观点:请再看看其他 JVM 语言。对象函数式的 Scala 语言给我留下了深刻的印象:它的性能几乎与 Java 一样好,并且具有很强的表达能力。

更新:关于 JavaScript 的好书有:JavaScript:权威指南 和 < a href="https://rads.stackoverflow.com/amzn/click/com/0596517742" rel="noreferrer">JavaScript:好的部分。您需要的唯一特定于 Rhino 的内容是此处

I've used Rhino as a part of a production-grade VoiceXML interpreter written in Java and running on the JVM. It works extremely well for this purpose. If I were reimplementing this interpreter from scratch, I would have leaned towards doing even more of my development in JavaScript. So it's definitely an option. You'll need to explore how mature the surrounding libraries are for your application area (you can always write logic that calls out from JavaScript to Java libraries, but that might be too laborious).

But I also agree with @Peter Recore: do give the other JVM languages a second look. I'm impressed with the object-functional Scala language: its performance is nearly as good as Java, and it has a lot of expressive power.

Update: Good books to read on JavaScript are: JavaScript: The Definitive Guide and JavaScript: The Good Parts. The only Rhino-specific stuff you'll need is here.

留一抹残留的笑 2024-09-17 09:03:12

我从未使用过Rhino,所以我无法提供技术原因,但作为一名通用程序员,我可以提供一个流行的心理学理论:

在JavaScript的大部分生命中,至少在人们的头脑中,JavaScript一直是严格的客户端语言。更糟糕的是,它看起来很糟糕,因为使用 JavaScript 的网页总是存在问题。这些问题并不一定是语言的错误,而是浏览器如何实现它、它们如何组织 dom 以及我们能够通过 javascript 访问的内容。但在我们的头脑中,我们开始认为“javascript 有问题”,甚至只是“javascript 的功能有限”。

因此,尽管有些人可以用它实现所有高级魔法,但我们中的许多人都认为 javascript 是一种玩具语言,从我们对网络的早期记忆来看,它所能做的就是通过鼠标悬停来改变图像。

最后,为了让一种语言变得流行(特别是在缺乏大型企业赞助商的情况下),它需要比现有语言有一些切实的好处。已经有很多服务器端语言、框架和运行时在争夺人们的注意力。 javascript 有什么特别之处以至于人们应该放弃对他们已经使用的 X 技术的投资? (这不是对js的挖苦,只是发人深省)

I have never used Rhino so I can't offer technical reasons, but as a generic programmer, I can offer up a pop psychology theory:

For most of its life, javascript has been strictly a client side language, at least in people's heads. Even worse, it seemed like a crappy one, because there were always problems on web pages with javascript. These problems weren't necessarily the fault of the language so much as how the browsers implemented it, how they organized the dom, and what we were able to access through javascript. But in our heads we began to think "javascript has issues" or even just "javascript is limited in what it can do".

So despite all the high level magic some people can do with it, many of us think of javascript as a toy language, from our early memories of the web where all it could do was make an image change on a mouse rollover.

Finally, for a language to become popular,(especially when lacking a huge corporate sponsor) it needs to have some tangible benefit over the existing ones. There are already a lot of server side languages, frameworks, and runtimes competing for people's attention. What is so special about javascript that people should throw away their investments in technology X that they already use? (that's not a dig at js, just food for thought)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文