Is Rhino the only interpreter with support for sandboxing and serializable continuations?
Asked Answered
G

3

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?

Guajardo answered 7/3, 2011 at 15:1 Comment(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.Chucho
L
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.

Lizethlizette answered 7/3, 2011 at 23:25 Comment(2)
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.Guajardo
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. docs.racket-lang.org/reference/Sandboxed_Evaluation.html 2. docs.racket-lang.org/web-server/…Culverin
G
0

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

Glidebomb answered 15/3, 2011 at 10:30 Comment(1)
Thanks! I hadn't heard of that version of Scheme before. I'm not sure Scheme is suitable as an introductory language, unfortunately :(Guajardo
G
0

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

Guajardo answered 29/12, 2013 at 3:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.