Idea: scripting for the rest of us.

Rhino has had continuations for a long time now. JavaScript is the language of the web. However, long-running executions are generally only discussed in the context of business processes, whereas in fact anything can be a long-running process.

For example, against an API for a hypothetical group todo list/document review tool (getActions, followupActions, review, distribute), a regular committee or meeting can be run like this:
var minutes;
while( ! disbanded) {
var oldActions = followupActions(minutes == null ? null : minutes.actions);
var newActions = getActions(participants);
minutes = {actions: newActions.join(oldActions)};
var accepted = false;
do {

accepted = review(minutes);
} while( ! accepted);

This could be for a school board, church council, or whatever. Also, you can use this format to (e.g.) organise rotas, timetables, casual chess tournaments, games of hide-and-seek or anything else.

In practise the API would be far more general than the one posited above, and the four methods above would themselves be functions.

I think that you could use this mechanism to do games, interesting projects or social activities with the Facebook API, for example. You could publish scripts, and scripts of scripts or libraries of functions, oh my! All kinds of interesting things. Anyway, I made some mockups of a potential iPhone application using this tool since it's probably the closest I'll ever get to actually building something like this. This is what would happen when you load a script (the user is responding to an invitation and has just clicked on "view source" to see what s/he is being invited to participate in):

And this is what happens when running a script (likewise the user has clicked/expanded "you are here"):

Would be interesting, no?

No comments: