Next: Throwable
Up: The Java type model
Previous: Primitive types
Every user-defined class is a subclass of a parent class (which may be
java.lang.Object).
A value of the parent class can be cast to the type of an object,
an object can be concatenated to a string,
its type can be queried,
and references can be compared for equality.
An OIL class is used as a template to create the operations required by
the Java class:
CLASS classOps() BEGIN
OPER
strclsOp(classOps,stringType): stringType;
clsstrOp(stringType,classOps): stringType;
clseqOp, clsneOp(classOps,classOps): boolType;
clsCondOp(classOps,classOps): classOps;
COERCION
(nullType): classOps;
END;
CLASS classInh(parentClass) BEGIN
OPER
narrowOp(parentClass): classInh;
COERCION
(classInh): parentClass;
END;
INDICATION
plusInd: strclsOp, clsstrOp;
castInd: narrowOp;
conditionalInd: clsCondOp;
eqlInd: clseqOp;
neqInd: clsneOp;
equalInd: clsCondOp;
This macro is defined in definitions 9, 10, 11, and 12.
This macro is invoked in definition 4.
A special type is used as the type of a class literal, and we need a bogus
operator to define it:
OPER classOp(classType): classType;
This macro is defined in definitions 9, 10, 11, and 12.
This macro is invoked in definition 4.
Next: Throwable
Up: The Java type model
Previous: Primitive types
2008-09-11