All Packages Class Hierarchy This Package Previous Next Index
Class Jaja.Box
java.lang.Object
|
+----Jaja.Jaja
|
+----Jaja.Value
|
+----Jaja.Box
- public class Box
- extends Value
This class implements mutable boxes (or references in ML
parlance). A box holds a single value at any time and may be
modified to hold another value. Boxes are used to implement mutable
variables in Jaja (so they can be shared since the compiler uses
flat closures copying the bindings they close.
Normally, in Scheme, a Box is not a first-class value and
therefore should not inherit from Value. But for ML and for typing
reason this is easier.
A non initialized box holds a null content.
-
content
- Only mutated through setBoxContent.
-
Box()
-
-
Box(Value)
-
-
getBoxContent()
- Read the content of a box.
-
setBoxContent(Value)
- Modify the content of a Box.
content
protected Value content
- Only mutated through setBoxContent. Unfortunately this slows
down read access which has to pass through a method.
Box
public Box()
Box
public Box(Value c)
setBoxContent
public synchronized Value setBoxContent(Value value)
- Modify the content of a Box. Returns the former content.
getBoxContent
public Value getBoxContent()
- Read the content of a box. this does not need to be a synchronized
method since the JVM warrants an atomic access to 32 bits pointers.
All Packages Class Hierarchy This Package Previous Next Index