sisc.data
Class Value

java.lang.Object
  extended by sisc.util.Util
      extended by sisc.data.Expression
          extended by sisc.data.Value
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable, Immediate, ExpressionVisitee, Version
Direct Known Subclasses:
AnnotatedExpr, Box, Buffer, DelegatingSymEnv, EOFObject, ExpressionValue, HashtableBase, JavaObject, LexicalEnvironment, MemorySymEnv, NativeLibrary, Networking.SchemeServerSocket, Networking.SchemeSocket, Nothing, Pair, Procedure, Quantity, Record, SchemeBinaryInputPort, SchemeBinaryOutputPort, SchemeBoolean, SchemeCharacter, SchemeCharacterInputPort, SchemeCharacterOutputPort, SchemeString, SchemeThread, SchemeVector, SchemeVoid, Symbol, Syntax, Threads.CondVar, Threads.Mutex, Types.SchemeType, Values

public abstract class Value
extends Expression
implements Immediate

Value is the base class for anything treated as a first-class value within Scheme.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class sisc.data.Expression
annotations, EMPTYSET
 
Fields inherited from class sisc.util.Util
BACKQUOTE, BEGIN, bundles, caseSensitive, EMPTYLIST, EMPTYVEC, EOF, ERRORK, EVAL, EXPSC, EXPTOP, FALSE, FCONT, FIVE, JEXCEPTION, LAMBDA, LOCATION, maxFloatPrecision, MESSAGE, minFloatPrecision, NAME, OTHER, PARENT, permitInterrupts, QUOTE, QUOTESYM, REPORT, SETBANG, SISC, SISC_SPECIFIC, SISCB, SOURCE_COLUMN, SOURCE_FILE, SOURCE_LINE, SYMENV, THIS, TOPLEVEL, TRUE, UNQUOTE, UNQUOTE_SPLICING, VOID, ZV
 
Fields inherited from interface sisc.util.Version
VERSION
 
Constructor Summary
Value()
           
 
Method Summary
 void apply(Interpreter r)
           
abstract  void display(ValueWriter w)
           
 void displayNamedOpaque(ValueWriter w, java.lang.String type)
          Helper function to generate an opaque type representation which may be named
 boolean equals(java.lang.Object v)
          Compares this Value to another.
 boolean eqv(java.lang.Object v)
          Compares this Value to another for equality according to the rules of Scheme's eqv?.
 void eval(Interpreter r)
          Called to evaluate this value.
 Value express()
          A debugging function, express returns a Scheme value that describes this expression.
 Value getValue(Interpreter r)
          Called to obtain the value of this Value.
 java.lang.String synopsis()
           
 java.lang.String synopsis(int limit)
          A synopsis is a limited number of characters of a human readable Value representation.
 java.lang.String toString()
           
 boolean valueEqual(Value v)
          Compares this value to another for semantic equality.
 int valueHashCode()
          a hashCode function consistent with valueEqual
 void write(ValueWriter w)
           
 java.lang.Object writeReplace()
           
 
Methods inherited from class sisc.data.Expression
deserialize, deserializeAnnotations, getAnnotation, getAnnotation, getAnnotationKeys, getAnnotations, getName, readExternal, readResolve, serialize, serializeAnnotations, setAnnotation, setAnnotation, setName, visit, visitAnnotations, writeExternal
 
Methods inherited from class sisc.util.Util
annotated, annotatedAppEval, append, argCheck, argsToSymbols, assq, bininport, bininstream, binoutport, binoutstream, box, character, charinport, charinreader, charoutport, charoutwriter, charsetFromString, chr, cont, currentClassLoader, env, error, error, error, error, error, error, error, expr, getDefaultCharacterSet, immutablePair, immutableVector, inport, javaExceptionToString, javaWrap, justify, length, liMessage, liMessage, liMessage, liMessage, liMessage, liMessage, liMessage, list, list, list, list, list, makeURL, mapcar, memq, nlib, num, outport, pair, pairToExpressions, pairToExpVect, pairToValues, proc, read, registerBundle, reverse, reverseInPlace, simpleErrorToString, sourceAnnotations, str, string, sym, symbol, symval, truePair, truth, truth, typeError, typeError, updateName, url, url, url, valArrayToList, valArrayToList, valArrayToVec, vec, warn, warn, warn
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Value

public Value()
Method Detail

display

public abstract void display(ValueWriter w)
                      throws java.io.IOException
Throws:
java.io.IOException

apply

public void apply(Interpreter r)
           throws ContinuationException
Throws:
ContinuationException

synopsis

public java.lang.String synopsis()

synopsis

public java.lang.String synopsis(int limit)
A synopsis is a limited number of characters of a human readable Value representation. They are used in errors or informational messages where the entire value's representation is not necessary.

Parameters:
limit - The number of characters to display

write

public void write(ValueWriter w)
           throws java.io.IOException
Throws:
java.io.IOException

equals

public boolean equals(java.lang.Object v)
Compares this Value to another. By default equal to eqv.

Overrides:
equals in class java.lang.Object
Parameters:
v - the other Value

eqv

public boolean eqv(java.lang.Object v)
Compares this Value to another for equality according to the rules of Scheme's eqv?. In SISC, this differs from eq? in that eq? is strict pointer equality.

Parameters:
v - the other Value

valueEqual

public boolean valueEqual(Value v)
Compares this value to another for semantic equality. Used to implement Scheme's 'equal?'. Subclasses must test for pointer equality as well as semantic equality, so that infinite loops on recursive structures are less likely.

Parameters:
v - the other Value

valueHashCode

public int valueHashCode()
a hashCode function consistent with valueEqual

Returns:
hash code

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

eval

public void eval(Interpreter r)
          throws ContinuationException
Called to evaluate this value. As Values ordinarily evaluate to themselves, this method simply sets acc to this.

Specified by:
eval in class Expression
Parameters:
r -
Throws:
ContinuationException

getValue

public Value getValue(Interpreter r)
               throws ContinuationException
Called to obtain the value of this Value. Simply this.

Specified by:
getValue in interface Immediate
Overrides:
getValue in class Expression
Parameters:
r -
Returns:
the immediate value of this expression, or null if the value cannot be obtained immediately.
Throws:
ContinuationException

express

public Value express()
Description copied from class: Expression
A debugging function, express returns a Scheme value that describes this expression. See examples in sisc.exprs.*

Specified by:
express in class Expression

displayNamedOpaque

public void displayNamedOpaque(ValueWriter w,
                               java.lang.String type)
                        throws java.io.IOException
Helper function to generate an opaque type representation which may be named

Throws:
java.io.IOException

writeReplace

public java.lang.Object writeReplace()
                              throws java.io.ObjectStreamException
Throws:
java.io.ObjectStreamException