你在java世界中首选的脚本语言(JVM上的脚本语言)和方式是什么?

发布于 2024-07-15 18:56:56 字数 102 浏览 13 评论 0原文

你在java世界中首选的脚本语言(JVM上的脚本语言)和方式是什么? 您什么时候更喜欢脚本语言而不是 Java(在什么情况下,例如用于原型设计)? 您将其用于大型项目还是仅用于个人项目?

What is your preferred scripting language in java world (scripting language on JVM) and way? When do you prefer your scripting language over java (in what situations for example for prototyping)? Do you use it for large projects or for personal projects only?

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

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

发布评论

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

评论(8

〃温暖了心ぐ 2024-07-22 18:56:56

对我来说,Clojure 轻而易举地获胜。 作为 Lisp,它简洁且动态类型,具有巨大的表达能力,因此我可以在几行内编写很多功能。 它与 Java 的集成是无与伦比的——当我说 Clojure 比 Java 本身更兼容 Java 时,我只是在开玩笑。 因此,来自 JDK 和第 3 方的所有 Java 库都完全可用。

最后,只要稍加小心,Clojure 代码就可以和 Java 代码一样快,所以我什至不会损失性能。

For me, Clojure wins hands down. Being a Lisp, it's concise and dynamically typed, it has enormous expressive power so I can write a lot of functionality in a few lines. And its integration with Java is unsurpassed – I'm only partly joking when I say Clojure is more compatible to Java than Java itself. As a result, the entire breadth of Java libraries, both from the JDK and 3rd party, is fully useable.

Finally, with a little care Clojure code can be as fast as Java code, so I'm not even losing performance.

浪漫之都 2024-07-22 18:56:56

我最喜欢的是 Jython,我通过在 Java 应用程序中嵌入 Jython 解释器来使用它。 它正在商业项目中使用,它允许根据客户的需求轻松定制应用程序,而无需编译任何内容。 只需将脚本发送给他们即可。 有些客户甚至可能自己定制他们的应用程序。

My favorite is Jython, and I use it by embedding a Jython interpreter in my Java application. It is being used in commercial projects, and it allows to easily customize the application according to the customers' needs without having to compile anything. Just send them the script, and that's it. Some customers might even customize their application themselves.

夏雨凉 2024-07-22 18:56:56

我已在商业项目中成功使用 Groovy。 我更喜欢脚本语言,因为鸭子类型和闭包:

def results = []
def min = 5
db.select(sql) { row ->
    if (row.value > min)
        results << row;
}

翻译:对数据库运行 SQL 查询,并将列“value”大于“min”的所有行添加到“result”。 请注意,您可以轻松地将数据传递到内部“循环”或从中获取结果。 是的,我知道我可以使用 SQL 实现相同的目的:(

def results = []
def min = 5
db.select(sql, min) { row ->
    results << row;
}

想象一下“sql”中的字符串在正确的位置有一个“?”)。

恕我直言,使用不提供丰富列表操作(排序、过滤、转换)和闭包的语言的数据库只是作为一个示例,您不应该这样做。

我很想更多地使用 Jython,但 Jython 2.5 的工作最近才开始,而 Python 2.2 对于我的目的来说太旧了。

I've successfully used Groovy in a commercial project. I prefer scripting languages because of duck typing and closures:

def results = []
def min = 5
db.select(sql) { row ->
    if (row.value > min)
        results << row;
}

Translation: Run a SQL query against the database and add all rows where the column "value" is larger than "min" to "result". Note how easily you can pass data to the inner "loop" or get results out of it. And yes, I'm aware that I could achieve the same with SQL:

def results = []
def min = 5
db.select(sql, min) { row ->
    results << row;
}

(just imagine that the String in "sql" has a "?" at the right place).

IMHO, using a DB with a language which doesn't offer rich list operations (sort, filter, transform) and closures just serves as an example how you should not do it.

I'd love to use Jython more but the work on Jython 2.5 has started only recently and Python 2.2 is just too old for my purposes.

百善笑为先 2024-07-22 18:56:56

我可能更喜欢 Scala,但我不能说,仍在学习。 目前正在使用 Groovy 编写小型实用程序。 甚至还没有尝试过 Groovy on Grails。 还听说过很多关于 Scala 的 Lift Framework 的好消息。

I might prefer Scala, but I can't say, still learning. At the moment using Groovy to write small utility programs. Haven't tried even Groovy on Grails. Heard lots of good about Lift Framework for Scala as well.

愛放△進行李 2024-07-22 18:56:56

JavaScript Rhino 有一个引人注目的优势——它是 包含在 JDK 中。 话虽如此,Rhino 的更高版本比 Java 6 版本具有更好的功能,例如 生成器、数组理解和解构赋值。

每当处理 Java 异常的仪式使代码变得混乱且没有任何实际好处时,我就喜欢使用它。 当我想编写一个利用 Java 库的简单命令行脚本时,我也会使用它。

JavaScript Rhino has a compelling advantage -- it is included with the JDK. That being said, later versions of Rhino than the one with Java 6 have nice features like generators, array comprehensions, and destructuring assignment.

I favor using it whenever the ceremony of handling Java exceptions clutters up the code for no real benefit. I also use it when I want to write a simple command-line script that takes advantage of Java libraries.

可可 2024-07-22 18:56:56

爪哇。 严重地。 它是一种功能强大、易于使用(虽然有点冗长)的人人都知道的语言。 与 Java 的集成非常棒。

Java. Seriously. It's a powerful, easy-to-use (if a tad verbose) language that everybody knows. The integration with Java is great.

将军与妓 2024-07-22 18:56:56

我工作的公司将 Groovy 嵌入到 Java/Spring 网站中,该网站部署在多个站点上。 这些脚本存储在已编译的 WAR 文件的外部,允许我们操作一些站点逻辑,而无需向每个站点推出新的 WAR。 到目前为止,这种方法对我们来说效果非常好。

Groovy 的一个特别好的特性是它可以非常类似于 Java 代码,这使得将现有的 Java 类移植到其中变得非常容易。

The company I work for embeds Groovy into a Java/Spring website, which is deployed on a number of sites. The scripts are stored externally of the compiled WAR file, and allow us to manipulate some of the site logic without having to roll out new WAR's to each site. So far, this approach has worked very elegantly for us.

A particularly nice feature of Groovy is that it can closely resemble Java code, which makes it very easy to port existing Java classes to it.

蒗幽 2024-07-22 18:56:56

SISC(方案代码第二解释器)怎么样?

参考:http://sisc-scheme.org/

How about SISC (Second Intepreter of Scheme Code)?

REF: http://sisc-scheme.org/

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