The Nature of Self
object N: Nat, object I: INT
- Self is a "recursive variable"
- rec-var N: record
var NUM: newint;
proc SUCC = N.NUM := @N.NUM+1;
proc PLUSTWO =
call N.SUCC;
call N.SUCC
end
- rec-var I: record
var NUM: newint;
proc PLUSTWO =
call I.SUCC;
call I.SUCC
var ISNEG: newbool
proc SUCC =
if not I.ISNEG then ...
else ...; fi
end
- self is resolved to N respectively I!
Author: Wolfgang Schreiner
Last Modification: May 14, 1998