Go backward to
Problems with Subtyping
Go up to
Top
Go forward to
Subtyping
Dynamically Scoped Objects
Class is parameterized on value of
self
:
[[
class
I=T]]
e
s
= ({I=
f
},
s
)
where
f
s'
m
= [[T]](
e
-U- {
self
=
m
})
s'
Meaning of
self
supplied at declaration:
[[
object
I
1
: I
2
]]
e
s
= ({I
1
=
b
},
s'
)
where (
b
,
s'
) =
f
s
b
and (I
2
=
f
) in
e
b
is defined in terms of itself!
Type structures
T ::=
newint
|
record
D
end
|
inherits
T
1
with
T
2
| I
[[
newint
]]
e
s
=
allocate
s
[[
record
D
end
]]
e
s
= [[D]]
e
s
[[
inherits
T
1
with
T
2
]]
e
s
= (
e
1
-U-
e
2
,
s
2
)
where (
e
1
,
s
1
) = [[T
1
]]
e
s
and (
e
2
,
s
2
) = [[T
2
]](
e
-U-
e
1
)
s
1
[[I]]
e
s
=
f
s
m
where (I=
f
) in
e
and (
self
=
m
) in
e
Author:
Wolfgang Schreiner
Last Modification: May 14, 1998