Class RTS_NAME<T>
- Type Parameters:
T
- the type of the parameter
The Abstract Class RTS_NAME
The basic principle is to establish an object within the calling scope. This object will have two attribute methods; 'get' og 'put' to evaluate and read the value of the actual parameter, or, if legal, to write into it. The following Java-class is used to perform such parameter transmissions:
abstract class RTS_NAME{ abstract T get(); void put(T x) { error("Illegal ..."); } }
Note that we both use abstract Java classes and 'generics' i.e. the actual type is a parameter. Also note that the 'put' method has a default definition producing an error. This enables redefinition of the 'put' method to be dropped for expression as actual parameters.
Suppose the Simula Procedure:
procedure P(k); name k; integer k; k:=k+1;
It will be translated to something like this Java method:
void P(RTS_NAMEk) { k.put(k.get() + 1); // E.g: k=k+1 }
In the calling place, in practice in the actual parameter list, we create an
object of a specific subclass of RTS_NAME
new RTS_NAME() { Integer get() { return (q); } void put(Integer x) { q = (int) x; } }
However, if the actual parameter is an expression like (j + m * n) then it will be coded as follows:
new RTS_NAME() { Integer get() { return (j + m * n); } }
Here we see that the 'put' method is not redefined so that any attempt to assign a new value to this name parameter will result in an error message.
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe environment in which evaluations of get'parameters will take place. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
_CUR
The environment in which evaluations of get'parameters will take place.
-
-
Constructor Details
-
RTS_NAME
public RTS_NAME()Construct a RTS_NAME object
-
-
Method Details
-
get
-
put
-
toString
-