8

I need (a) sandboxing, and (b) serializeable continuations. I'm exposing server-side game scripting to users, and it is extremely async, thus the callback pattern makes code un-readable and very un-approachable for newbie programmers. A continuation-passing style is an alternative, but has the same drawbacks. Async in the sense that a query to the user may take months to complete.

See http://weaverengine.com/platforms for my full list

Serializeable continuations seem like a very elegant solution, but few interpreters support them.

So far, it seems that my only option is Rhino. I was hoping that NodeJS or PyPy would work, but the evidence so far points to the contrary.

Lua seems to support coroutines, but I can't find any information on whether it supports serializeable continuations. Lua does sandboxing well.

NodeJS has Jefe to offer really nice sandboxing, but nothing so far regarding continuation serialization.

PyPy also hasn't yet refined their sandboxing and serializeable continuation support to the point where they can be used together, from what I understood on the pypy-dev mailing list.

JavaFlow hints that if all classes implement Serializeable, then java continuations could be serialized. But unless I can run an interpreter for a nice dynamic language on top of JavaFlow, I'm not interested.

Is Java and Rhino my only option?

Is there a branch of NodeJS with continuation support? Any reasonably nice, dynamic language that meets these criteria?

Community
  • 1
  • 1
Lilith River
  • 16,204
  • 2
  • 44
  • 76
  • 1
    Just a note: Rhino's Continuations are only available when it is run in interpretive mode (-opt -1). Rhino can be run a couple of ways, and normally it JIT-compiles Java bytecode, or can be compiled ahead-of-time to bytecode using jsc. Of course, running in interpretive mode is slower, so if performance is an issue, this is something important to be aware of. – jbeard4 Mar 08 '11 at 16:25

3 Answers3

2

I'm suprised you did not mention Scheme, as that is the language where continuations where pioneered. SISC for example is a Scheme interpreter running on the JVM that supports serializable continuations. These are used for example in the SISCweb framework.

For sandboxing you could use the builtin security features of the jvm.

Jörn Horstmann
  • 33,639
  • 11
  • 75
  • 118
  • Thanks! I've read about continuations on other versions of scheme, but those implementations were *not* serializeable. I'm not sure if Scheme is the best language to teach people how to program with - I consider it advanced, but extremely powerful and useful. – Lilith River Mar 08 '11 at 11:03
  • Racket has excellent sandboxing support[1]. It also supoprts serializable continuations in its slightly restricted "web-server" language[2]. And if you don't like the web-server language, you could use it as an example to implement your own sandboxed scripting language with serializable continuations. 1. https://docs.racket-lang.org/reference/Sandboxed_Evaluation.html 2. https://docs.racket-lang.org/web-server/stateless.html#%28def._%28%28lib._web-server%2Flang%2Fabort-resume..rkt%29._call-with-serializable-current-continuation%29%29 – Sean Lynch Feb 23 '18 at 17:50
0

I ended up using Lua 5.1.4 and Pluto. Seems to be a good choice so far.

Lilith River
  • 16,204
  • 2
  • 44
  • 76
0

It should be possible to serialize continuations in Gambit-C.

knivil
  • 916
  • 5
  • 10
  • Thanks! I hadn't heard of that version of Scheme before. I'm not sure Scheme is suitable as an introductory language, unfortunately :( – Lilith River Mar 16 '11 at 15:35