Standard Class Objects

    Input and output to standard devices is made through objects In, Out, and OutError as shown in the next code.

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 .
 

What is new ?

    The soul and flesh objects and the idea that a program may be modified by attaching shells to its flesh objects. For example, one could attach the output of a program to the input of another thus creating a Unix pipe. The report has a longer discussion about this. Object Memory was based in class MEMORY of Eiffel. We do not know of any other language that supports an object/class like Runtime used for interactions with the run-time system. Of course, there are languages that offer functionalities similar to those of object Runtime but in a different form.

Return