orc.runtime.values
Class Value

java.lang.Object
  extended by orc.runtime.values.Value
Direct Known Subclasses:
Closure, Field, ListValue, Site, TaggedValue

public abstract class Value
extends java.lang.Object

A fully evaluated Orc value. This includes sites, tuples, lists, and so on. However, it does not include unbound or partially-bound values, which are instead in the broader category of Futures.

Author:
dkitchin

Field Summary
static Callable futureNotReady
          Distinguished value used to indicate that a forced value is not ready.
 
Constructor Summary
Value()
           
 
Method Summary
<E> E
accept(Visitor<E> visitor)
           
static java.lang.Object forceArg(java.lang.Object f, Token t)
          Force a value (which may be a future) in argument position.
static Callable forceCall(java.lang.Object f, Token t)
          Force a value (which may be a future) in call position.
static Value signal()
          Static function to access the canonical 'unit' value; currently, the signal value is an empty tuple.
static java.lang.String write(java.lang.Object v)
          Convert any object to its string representation; the inverse of Read.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

futureNotReady

public static final Callable futureNotReady
Distinguished value used to indicate that a forced value is not ready. Don't try to use this value in Orc programs. We use this instead of throwing an exception because I suspect it's much faster for the common case.

Constructor Detail

Value

public Value()
Method Detail

forceCall

public static Callable forceCall(java.lang.Object f,
                                 Token t)
                          throws UncallableValueException
Force a value (which may be a future) in call position. If the future is not ready, return futureNotReady and place the token on a waiting list to be reactivated when the future is ready.

The primary reason to distinguish call and argument values is that a closure is allowed to have unforced free values in call position, but not in argument position (lest those unforced free values escape their lexical context).

Throws:
UncallableValueException

forceArg

public static java.lang.Object forceArg(java.lang.Object f,
                                        Token t)
Force a value (which may be a future) in argument position. If the future is not ready, return futureNotReady and place the token on a waiting list to be reactivated when the future is ready.


signal

public static Value signal()
Static function to access the canonical 'unit' value; currently, the signal value is an empty tuple.


accept

public <E> E accept(Visitor<E> visitor)

write

public static java.lang.String write(java.lang.Object v)
Convert any object to its string representation; the inverse of Read.