Search code examples
javascriptactionscript-3dynamic-languagesscripting-languageecma262

What scripting languages are similar to ECMA?


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.


Solution

  • 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.