Sometimes you want to embed a script in a part of "structured data" such as json, xml, database. Of course, you can put something like a closure in the data structure unique to the language (example: map + hash), but if possible, you want to implement it in a language-independent way.
Therefore, I investigated whether it is possible to execute typical script languages (Python, PHP, Ruby, javascript) on various platforms.
- | Python | PHP | Ruby | JavaScript | Java | .NET/Mono |
---|---|---|---|---|---|---|
Python | - | Brython | Jython | IronPython | ||
PHP | - | Quercus | Phalanger | |||
Ruby | - | JRuby | IronRuby | |||
JavaScript | PyV8 | PHP-spidermonkey | execjs | - | Rhino / Nashorn | JScriptEvaluate |
Looking at this, I think that the most versatile language is JavaScript. If you want to cover all major platforms, JavaScript may be a good choice.