orc.runtime.values
Class Closure

java.lang.Object
  extended by orc.runtime.values.Value
      extended by orc.runtime.values.Closure
All Implemented Interfaces:
Callable, Future

public final class Closure
extends Value
implements Callable, Future

Represents a standard closure: a function defined in an environment.

A closure is not necessarily a resolved value, since it may contain unbound variables, and therefore cannot be used in arg position until all such variables become bound.

Author:
wcook, dkitchin, quark

Field Summary
 Def def
           
 Env env
           
 
Fields inherited from class orc.runtime.values.Value
futureNotReady
 
Constructor Summary
Closure(Def def, java.util.List<java.lang.Object> free)
          The environment should be set later; see DefsDeclaration.
 
Method Summary
<E> E
accept(Visitor<E> visitor)
           
 void createCall(Token t, java.util.List<java.lang.Object> args, TokenContinuation publishContinuation)
          Create a call to a callable value
 java.lang.Object forceArg(Token t)
           
 Callable forceCall(Token t)
           
 
Methods inherited from class orc.runtime.values.Value
forceArg, forceCall, signal, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

def

public Def def

env

public Env env
Constructor Detail

Closure

public Closure(Def def,
               java.util.List<java.lang.Object> free)
The environment should be set later; see DefsDeclaration.

Method Detail

createCall

public void createCall(Token t,
                       java.util.List<java.lang.Object> args,
                       TokenContinuation publishContinuation)
                throws TokenException
Description copied from interface: Callable
Create a call to a callable value

Specified by:
createCall in interface Callable
Parameters:
t - token for which the call is being made: points to the call node
args - argument list
publishContinuation - next node after the call node, to which the result should be sent
Throws:
TokenException

accept

public <E> E accept(Visitor<E> visitor)
Overrides:
accept in class Value

forceArg

public java.lang.Object forceArg(Token t)
Specified by:
forceArg in interface Future

forceCall

public Callable forceCall(Token t)
                   throws UncallableValueException
Specified by:
forceCall in interface Future
Throws:
UncallableValueException