Out.writeln( "Number x
= ", 5, " but percent = ", 50.7 );
// variables can be
declared anywhere
var ch : char;
ch = In.readChar();
var i : integer;
i = In.readInteger();
Out.writeln("ch = ", ch,
" i = ", i);
Object Storage has methods to manipulate disk files and the Internet (these not yet defined). Objects In, Out, and OutError use Storage to do their jobs.
Object Memory has methods
proc sizeLargestBlock()
: long
// returns the size in bytes of the largest memory block
proc sizeFreeMemory()
: long
// returns the size in bytes of the free memory
proc doGarbageCollection()
// calls the garbage collector
proc collectionOn()
proc collectionOff()
// turns on and off the garbage collection
to manage or introspect the memory system.
Object Screen is responsible for all graphical interactions with the user and for receiving input from the keyboard and mouse. The Screen methods have not been defined.
Object Runtime has methods
proc
exit( errorCode : integer )
/* finish the program and return errorCode. In an
object-oriented
operating system an object
would be returned */
proc
getClasses() : DS.iter(ClassInfo)
// returns an iterator for all the program classes
proc
searchForClass( name : String ) : ClassInfo
/* returns object describing class "name". The search
is made among
all program classes. If no class is found,
nil is returned. */
proc
getMethodCallStack() : DS.Stack(MethodCallInfo)
( exception : CatchNoReflectiveCallInfoException )
/* returns a stack with one object for each method in
the method call
stack. There will always be at least
one method in the stack. Exception
NoReflectiveCallInfoException is thrown
is the program
was not
compiled with information about the run-time
stack. */
proc
getCatchObjectStack() : DS.Stack(Catch)
/* returns a stack with the stack of catch objects.
This information will
always be availabe at run time. */
Objects
In, Out,
OutError, Storage, and
Screen are called souls because they conceptually are associated to
flesh objects with the same names living in the operating system domain.
Conceptually, soul object Out of
Green delegates the messages it receives to a flesh object
Out of the operating system. Then, an executing Green program can
be controlled by attaching shells to the flesh objects which are in the operating
system. A throughout discussion about this is found in
The Green Report
.