哪些脚本语言与 ECMA 类似?

发布于 2024-07-19 16:24:25 字数 476 浏览 11 评论 0原文

我正在寻找 ECMAScript 替代方案来作为自定义应用程序逻辑的脚本语言。 ECMA 有一些我喜欢的地方,尤其是新规范(如 AS3)的语法。

不幸的是,AS3 引擎不是开源的,无法集成到项目中。 我想要一种专为面向对象使用而设计的脚本语言。

具体来说,是否有一种语言具有:

  • 静态类型变量(可选)
  • 类,包括公共/私有成员
  • 继承,包括接口
  • 包(可选)
  • 干净的语法
  • 必须能够作为应用程序的内部脚本语言进行交互(例如用于应用程序的 Javascript) browser),不能被外部系统调用。

我宁愿不做的事情

  • 凌乱的 ECMA prototype 对象

您所了解的哪些语言适合此配置文件? 我很难找到一种专为良好的面向对象设计而设计的高质量脚本语言。

I am looking for an ECMAScript alternative to work as a scripting language for custom application logic. There are things I like about ECMA, especially the syntax for the newer spec(like AS3).

Unfortunately, the AS3 engine is not open source to be able to integrate in a project. I would like a scripting language that was designed for object oriented use.

Specifically, is there a language that has:

  • Statically typed variables(optional)
  • Classes, including public/private members
  • Inheritance, including Interfaces
  • Packages(optional)
  • Clean syntax
  • Must be able to interface as an internal scripting language for an application(like Javascript for a browser), can not be an external system call.

Things I would rather do without

  • The messy ECMA prototype object

What languages that you know about fit this profile? I've had difficulty finding a quality scripting language that was designed for good object oriented design.

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

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

发布评论

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

评论(9

始于初秋 2024-07-26 16:24:25

如果您想要一种像 ECMAScript 一样工作的脚本语言,为什么不使用 ECMAScript 呢? 有许多开源实现,只需查看 Wikipedia 上的列表即可。

If you want a scripting language that works like ECMAScript, why not use ECMAScript? There are many Open Source implementations, just take a look at the list on Wikipedia.

橘和柠 2024-07-26 16:24:25

我推荐 Python 或 Ruby。 两者都不像 ECMA,但我是在 JavaScript 之后学习它们的,而且它们很容易上手。 另外,它们是更强大的语言,使其成为在应用程序内部使用 JavaScript 引擎(Rhino for Java)的更好替代方案。

Python

  • 强制使用干净的语法(几乎像英语 while is not False:
  • 多重继承(无接口)
  • 解释器可以使用 C/C++ 进行扩展(如果需要,可能用于您的适配器)

Ruby

  • 语法应该是接近英语(unless 条件,until 循环)
  • 一切都是对象
  • 只支持单一继承,但使用 Mixins 来添加功能

两个

  • 都可以嵌入到另一个应用程序中
  • 私有成员
  • 套餐

I'd recommend either Python or Ruby. Neither are like ECMA, but I learned them after JavaScript, and they were a snap to pick up. Plus, they are more powerful languages, making it a better alternative to using a JavaScript engine inside of your application (Rhino for Java).

Python

  • Forces clean syntax (almost like English while is not False:)
  • Multiple inheritance (no interfaces)
  • Interpreter can be extended using C/C++ (possibly used for your adapters, if needed)

Ruby

  • Syntax is supposed to be close to English (unless conditional, until loop)
  • Everything is an object
  • Only supports single inheritance, but uses Mixins to add functionality

Both

  • Classes
  • Can be embedded in another application
  • Private members
  • Packages
心的憧憬 2024-07-26 16:24:25

Lua - 你想要的一切以及更多内容,大约 100KB

参见 页面用于 Lua 和其他提到的语言之间的比较。

Lua - everything you want and more in ~100KB

See this page for comparison betwen Lua and other mentioned languages.

油饼 2024-07-26 16:24:25

Neko 上的 Haxe 看起来正是您想要的东西。 我不知道 nekovm 的嵌入式程度如何,但它是开源的,所以你可以摆弄它。 http://haxe.org

Haxe on Neko looks like the exact thing you want. I don't know how embeddable nekovm is, but it is opensource so you can fiddle with it. http://haxe.org

秋凉 2024-07-26 16:24:25

Ruby 解释器也可以嵌入到 C 程序中,并且可能被某些人认为是比 Python 更面向对象。

The Ruby interpreter can also be embedded within C programs, and may be considered by some to be more object-oriented than Python.

赤濁 2024-07-26 16:24:25

我们使用 ECMAscript 作为我所开发的软件产品的扩展语言,并且效果非常好。 作为一种标准(且流行)的语言,很高兴能够向我们的用户指出该语言的大量现成文档。 我们构建了自己的 ECMAscript 编译器,可以将其转换为我们正在运行的平台的字节码,但如果我可以重来一次,我会认真考虑嵌入 Google 的 V8 ECMAscript 引擎(事实上,我什至会考虑构建我们的整个应用程序)。

We use ECMAscript as an extension language for the software product I work on and it works quite well. Being a standard (and popular) language, it's nice to be able to point our users to the copious off the shelf documentation for the language. We built our own ECMAscript compiler that translates into bytecode for the platform we are running on, but if I had it to do over again, I'd seriously consider embedding Google's V8 ECMAscript engine (in fact, I'd even consider building our entire app on it).

今天小雨转甜 2024-07-26 16:24:25

在 Java 中,最好的 ECMAScript (Javascript) 选项是嵌入 Rhino。 我不认为基于原型的继承是一个交易杀手,因为通过一些纪律,你可以使它的行为几乎像基于类的继承。

如果您想要与 Java 紧密互操作的东西,请选择 Groovy。 如果您需要 JVM 兼容性,还可以查看 Jython(JVM 上的 python),Jruby(JVM 上的 Ruby)和 Scala(JVM 上的函数式语言)。 如果您不关心 Java 和 JVM 兼容性,请查看 RubyPythonErlang< /a>. Clojure 是 JVM 上 Lisp 的一种方言。

更进一步,TCL(工具命令语言)可以让你在C/C++代码中嵌入解释器,还有许多可嵌入的Lisp和Scheme解释器等。

In Java the best ECMAScript (Javascript) option is to embed Rhino. I don't find the prototype-based inheritance a deal killer, as with a bit of discipline you can make it behave almost like class-based inheritance.

If you want something that interoperates very closely with Java, go with Groovy. If you need JVM compatibility, also look into Jython (python on the JVM), Jruby (Ruby on the JVM) and Scala (a functional language on the JVM). If you don't care about Java and JVM compatibility, look at Ruby, Python, and Erlang. Clojure is a dialect of Lisp on the JVM.

Going further afield, TCL (Tool Command Language) lets you embed an interpreter in C/C++ code, there are many embeddable Lisp and Scheme interpreters, etc.

£噩梦荏苒 2024-07-26 16:24:25

我会选择一些相当主流的东西来简化事情。 阅读您的要求后,我建议 Python。 它实际上并不具有 Java/C# 方式的接口,但也并不真正需要它们。 除此之外,它应该很合适。

I'd go with something fairly mainstream to simplify things. Having read your requirements, I'd recommend Python. It doesn't really have interfaces in the Java/C# way, but it doesn't really need them, either. Other than that, it should be a good fit.

德意的啸 2024-07-26 16:24:25

QtScript 是 ECMAScript。 您没有提到您的应用程序的主要部分是用什么编写的,但我认为它不是 Qt,或者您已经了解 QtScript。

QtScript is ECMAScript. You don't mention what the main part of your application is written in, but I suppose it's not Qt, or you'd already know about QtScript.

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