jsint
Class Symbol

java.lang.Object
  extended byjsint.Symbol
All Implemented Interfaces:
SchemeSymbol, java.io.Serializable

public class Symbol
extends java.lang.Object
implements java.io.Serializable, SchemeSymbol

In Jscheme 1.0 to 1.4, symbols were implemented as Strings. In 1.5, we add a Symbol class, with a field for the global value. This makes global lookup faster, but limits us to only one global environment.

Author:
Peter Norvig, Copyright 1998, peter@norvig.com, license subsequently modified by Jscheme project members licensed under zlib licence (see license.txt)
See Also:
Serialized Form

Field Summary
static Symbol BEGIN
           
static Symbol CAR
           
static Symbol CDR
           
static Symbol DEFINE
           
static Symbol IF
           
static Symbol LAMBDA
           
static Symbol MACRO
           
static Symbol NEWLINE
           
static Symbol NULL
           
static Symbol OR
           
static Symbol PACKAGE
           
static Symbol QUASIQUOTE
           
static Symbol QUOTE
           
static Symbol SET
           
static Symbol SPACE
           
static java.util.Hashtable symbolTable
          The symbolTable keeps a unique mapping from String name to Symbol.
static Symbol UNQUOTE
           
static Symbol UNQUOTE_SPLICING
           
 
Method Summary
 java.lang.Object getGlobalValue()
          Getting the value of an undefined SchemeSymbol throws a SchemeException
static Symbol intern(java.lang.String name)
          Intern a string: look up or make a symbol.
 boolean isDefined()
          SchemeSymbols are initially undefined.
 java.lang.Object setGlobalValue(java.lang.Object newval)
          The value can be set to anything
 java.lang.String toString()
          A symbol can be printed using its name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

symbolTable

public static final java.util.Hashtable symbolTable
The symbolTable keeps a unique mapping from String name to Symbol.


BEGIN

public static final Symbol BEGIN

CAR

public static final Symbol CAR

CDR

public static final Symbol CDR

DEFINE

public static final Symbol DEFINE

IF

public static final Symbol IF

LAMBDA

public static final Symbol LAMBDA

MACRO

public static final Symbol MACRO

NEWLINE

public static final Symbol NEWLINE

NULL

public static final Symbol NULL

OR

public static final Symbol OR

QUASIQUOTE

public static final Symbol QUASIQUOTE

QUOTE

public static final Symbol QUOTE

SET

public static final Symbol SET

SPACE

public static final Symbol SPACE

UNQUOTE

public static final Symbol UNQUOTE

UNQUOTE_SPLICING

public static final Symbol UNQUOTE_SPLICING

PACKAGE

public static final Symbol PACKAGE
Method Detail

intern

public static Symbol intern(java.lang.String name)
Intern a string: look up or make a symbol.


toString

public java.lang.String toString()
A symbol can be printed using its name. We don't do escape processing.


getGlobalValue

public java.lang.Object getGlobalValue()
Description copied from interface: SchemeSymbol
Getting the value of an undefined SchemeSymbol throws a SchemeException

Specified by:
getGlobalValue in interface SchemeSymbol

setGlobalValue

public java.lang.Object setGlobalValue(java.lang.Object newval)
Description copied from interface: SchemeSymbol
The value can be set to anything

Specified by:
setGlobalValue in interface SchemeSymbol

isDefined

public boolean isDefined()
Description copied from interface: SchemeSymbol
SchemeSymbols are initially undefined.

Specified by:
isDefined in interface SchemeSymbol