Re: Safe, Closure-free, Serializable functions‏

Mike Samuel mikesamuel at
Thu Sep 26 12:52:13 PDT 2013

2013/9/26 David Bruant <bruant.d at>:
> Le 26/09/2013 01:29, François REMY a écrit :
>> Hi,
>> TLDR ==> The web needs a way to express executable code that does not rely
>> on its parent context, is guaranteed to be side-effect-free, and can be
>> executed safely anywhere (even in a different thread/worker/window/device,
>> or as callback for browser code being executed while the DOM is not ready to
>> be accessed)
> Why "need"? You don't really expose a use case. You only start with "It's
> been some time I've been working on this idea of a..."
> Also, one thing is not really clear to me. Are you trying to protect the
> function from its caller/loader or the caller from the function? both?

I can't speak for Françios but here's one use case:

I used similar things in

The design principle was that we can get the benefits of both
declarative configuration and dynamic scripting languages by running
scripts that produce serializable & relocatable data bundles that
include pure functions.

That wiki page is part of a build system that tries to get the benefit
of static declarative build systems and the flexibility of build shell
scripts by using a hacked version of Rhino that allows serialization
of some closures and exposes the inferred dependency graph via a web
service for inspection by other tools.

More information about the es-discuss mailing list