Go backward to
Name Equivalence
Go up to
Top
Go forward to
Generalization
Type-Structure Parameters
Build different versions of classes:
class
STACK1
=
record var
A
:
newint
;
proc
PUSH
=
A
:=0
end
class
STACK2
=
record var
A
:
newint
;
proc
PUSH
=
A
:=1
end
class
K
(
T
: {
A
:
intloc
,
PUSH
:
comm
}
class
) =
record var
S
:
T
;
proc
PUSH2
=
call
S
.
PUSH
;
call
S
.
PUSH
end
;
var
X
:
K
(
STACK1
);
var
Y
:
K
(
STACK2
)
K
is
generic
in the data structure it handles.
Type-structure parameters are lazily evaluated
Eager evaluation would activate type structure and bind allocated storage to formal parameter.
Author:
Wolfgang Schreiner
Last Modification: May 7, 1998