croczilla.com 
 home   stratified   bits&pieces   blog   
  home > bits&pieces > oni

Oni: an Embedded Structured Concurrency Language

Oni is a framework for managing the control flow of concurrent applications. There are two central ideas to Oni:

  • To make concurrent actions composable by implementing control structures with which asynchronous actions can be choreographed in the same way that traditional sequential languages implement control structures for choreographing synchronous actions.
  • To leverage the facilities of a "host language" rather than implement a complete programming language from scratch.

Oni can be implemented as a set of functions ("Oni operators") in a suitable host language, such as JavaScript or C++ (any reasonable language will do). Our current implementation, dubbed Oni/JS, is in JavaScript, targeted at in-browser use (should work in any modern browser - FF, Chrome, Safari, IE, ...). Many of the ideas of Oni/JS have been subsumed into the Stratified JavaScript language.

Oni requires no preprocessing or precompilation; an Oni program is a just an expression in the host language.

Oni leverages the type system, control structures and asynchronous facilities (message loop, etc) of the host language. Constructs (functions, etc) from the host language can be "lifted" into an Oni program. Conversely, Oni features can be introduced retroactively into a conventional program without requiring the whole program to be converted to a different style in any way.

Documentation & Examples

Main documentation
Mailing list
  • We have a very low-volume mailing list for Oni discussions and announcements here. Please consider subscribing to be kept up to date with ongoing Oni developements.
Presentations

Download it

Core Oni/JS

The browser-based version of the core Oni language consists of a single Javascript file which can be downloaded here:

Oni is included into a webpage like this:

<script type="text/javascript" src="oni.js"></script>

Oni should work with any modern browser. We've tested FF3, IE7, IE8, Chrome, Safari 3.2.

Oni/JS Ajax library

oni-ajax.js, the Oni/JS extension library for client-side Ajax programming can be downloaded here:


Future plans

Oni is usable in its current form, but is not under active development any more.


Related

Oni was mainly inspired by Orc (http://orc.csres.utexas.edu/), a "novel language for distributed and concurrent programming". In contrast to Orc, Oni doesn't implement a new syntax (it reuses the host language's syntax) and it has a more traditional control flow. Orc's control flow is somewhat "exotic" in that an expression can return several results. I believe that similar constructs could be implemented in Oni by adding first-class continuation support.

There are a number of JavaScript frameworks that try to address the same issues as Oni, namely converting asynchronous code into synchrous-style code, although I am not aware of any framework that define control structures over concurrently executing code as systematically and comprehensively as Oni does.

Some frameworks, such as Narrative JS (http://neilmix.com/narrativejs/doc/index.html) or jwacs (http://chumsley.org/jwacs/) implement syntax enhancements to JavaScript and thus require a compilation or parsing step.

At least one framework, Arrowlets (http://www.cs.umd.edu/projects/PL/arrowlets/index.xhtml), is fundamentally very similar to Oni; it provides a set of lifters and combinators used to build "programs" that can execute concurrently and asynchronously. Its JavaScript expressions are combined through method chaining, rather than function application like in Oni.