什么是能够理解数据类型并可以在 Java 中实现的脚本语言?
我正在寻找一种满足以下条件的脚本语言:
- 文档齐全
- 用 Java 实现
- 理解数据类型(可以处理长整型、字符串等)
- 完全可扩展
有什么建议吗? 目前,我正在使用 Javascript,但它设置数字的双精度数对于我正在做的数据工作来说不够大。
谢谢!
I am looking for a scripting language that meets the following criteria:
- Well Documented
- Implemented in Java
- Understands Datatypes (can handle longs, strings, etc)
- Is fully extensible
Any suggestions? Currently, I'm using Javascript, but the Doubles that it sets numbers to is not big enough for the data work I'm doing.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
Groovy
特别是,Groovy可以用作脚本语言,但不能必须如此,并且是构建在 Java 之上的。 它不是不同语言的 Java 端口,这意味着它与 Java 的集成比 JRuby/Jython 更紧密,尽管自从我上次查看它们以来,情况可能已经发生了变化。
至于 Groovy 的文档,您可能需要购买 Groovy in Action (插件插头 ;)
Groovy
In particular, Groovy can be used as a scripting language, but doesn't have to be, and is built on top of Java. It isn't a Java port of a different language, which means it integrates more closely with Java than JRuby/Jython, although that may have changed since I last looked at them.
As for documentation for Groovy, you may want to buy Groovy in Action (plug plug ;)
Python 和 Ruby 有 Java 实现(查找 Jython 和 JRuby)。
Python and Ruby have Java implementations (look for Jython and JRuby).
LuaJava 可能就是这样。 所有数字在 lua 内部都表示为双精度数。
LuaJava could be it. All numbers are represented internally as doubles in lua.
我不确定“理解数据类型”是什么意思。 如果你的意思是它有字符串、数字等,那么 JavaScript、Groovy、Python 和 Ruby 都是与 Java 集成良好的众多语言中的一些。 如果您正在寻找静态类型语言,我不确定。
关于 JavaScript 中双精度数不够大的问题,您可以从 JavaScript 代码中分配 Java BigDecimal 对象(或 BigInteger 对象)。 因此,数字表示对您来说不应该是问题。
I'm not sure what you mean by "understands data types". If you mean that it has strings, numbers, etc, then JavaScript, Groovy, Python, and Ruby are some of the many languages that integrate well with Java. If you're looking for a statically typed language, I'm not sure.
Regarding you problem of doubles not being big enough in JavaScript, you can allocate Java BigDecimal objects (or BigInteger objects) from within your JavaScript code. So, number representation shouldn't be an issue for you.
“它设置的数字对于我正在做的数据工作来说不够大”是什么意思? AFAIK 在大多数语言中双精度数的大小相同。
您需要多少精度? 如果您需要超过 16 位的精度,也许 BigDecimal 适合您。
What do you mean "Doubles that it sets numbers to is not big enough for the data work I'm doing." Doubles are the same size in most languages AFAIK.
How much precision do you need? Perhaps BigDecimal is for you if you need more than about 16 digits of precision.
我的建议是 Clojure 或 Groovy。
Jon 的回答 已经有一些关于 Groovy 的详细信息,所以这里有更多关于 Clojure 的信息:
特别是 Java 互操作非常简单:Clojure 对象是 Java 对象反之亦然,你可以直接调用方法:
Clojure or Groovy would be my recommendations.
Jon's answer already has some details on Groovy, so here's a little more on Clojure:
In particular Java interop is very simple: Clojure objects are Java objects and vice versa, and you can call methods directly: