ref_send API 2.17
defensive programming in Java

Class Beat

  extended by org.waterken.bang.Beat

public final class Beat
extends java.lang.Object

An introduction to eventual operations in Java.

This class provides an introduction to eventual operations by using them to update and query a counter held in an object of type Drum.

Method Summary
static void main(java.lang.String[] args)
          Executes the test.
static Promise<?> make(Eventual _, Drum drum)
          Runs a unit test.
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Method Detail


public static Promise<?> make(Eventual _,
                              Drum drum)
Runs a unit test.

This method is called by the infrastructure code that manages the lifecycle of vats. The return from this method is an object that will be returned to the creator of the new vat. In this case, the vat creator will get a promise for a boolean.

By convention, an instance of Eventual is held in a variable named "_" and referred to as the "eventual operator". The eventual operator provides all eventual control flow operations, as well as the ability to produce "eventual references", which are references that schedule future invocation of a method, instead of invoking a method immediately. All references known to be eventual are also stored in variables whose name is suffixed with the '_' character. Consequently, you can scan down a page of code, looking for the character sequence "_." to find all the operations that are expected to be eventual.

_ - eventual operator
drum - test subject


public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Executes the test.

This class can also be run from the command line, to run tests against a local, transient Drum. Most factory classes won't provide a command line test suite and so won't have a main(java.lang.String[]) method.

args - ignored
java.lang.Exception - test failed

ref_send API 2.17
defensive programming in Java

Submit a bug or feature, or get help

Copyright 1998-2009 Waterken Inc. under the terms of the MIT X license.