问题
I would like to write a web based MMO game that will allow users to write AI and run it as part of the game. I plan to use Html5 for graphics and want this to be web based so it can be accessed from smartphones. I need to find a programming language that will support sandboxing, concurrency, hot code swapping, and a large library to make things easier.
At this time my research is turning up Erlang, Stackless Python, and Lua. Any help is appreciated.
回答1:
Erlang does not support sandboxing, so you probably don't want to use that, at least for your scripting language. Erlang isn't ideal for scripting anyway, so that's probably ok.
Erlang would make a good backend language for a project like this, however, and I'd highly recommend it from personal experience.
I don't think Stackless has sandboxing support either, so that's probably also off the list.
Lua, on the other hand, explicitly supports sandboxing, and has coroutines, too: http://lua-users.org/wiki/SandBoxes, http://lua-users.org/wiki/CoroutinesTutorial, so I would recommend that for your scripting language.
Lua is also extremely easy to embed as seen in this tiny tutorial: http://heavycoder.com/tutorials/lua_embed.php (and you can even get away without all the library loading stuff since you'll want to be sandboxing it anyway).
回答2:
I'd also go with Lua due to it's absurd customizability and versality (if you don't like it's syntax you can change it to a functional or a python-like one). As said in the previous answer, you've got sandboxing and strong concurrency. I personally would never even think of embedding anything else than Lua ;>.
However, Lua lacks a expanded standard library, and this is where Python wins big time :/.
来源:https://stackoverflow.com/questions/2106385/which-programming-languages-support-hot-code-swapping-and-or-sandboxing