3 ms·
It doesn't even need to be a modern language to protect against that: BEGIN INT x := 1; print(("x is", x, newline)); GOTO later; INT y := 2
by dfawcus 2y ago
It doesn't even need to be a modern language to protect against that:
BEGIN
INT x := 1;
print(("x is", x, newline));
GOTO later;
INT y := 2;
later:
print(("y is", y, newline))
END
for which we have:
$ a68g goto.a68
x is +1
11 print(("y is", y, newline))
1
a68g: runtime error: 1: attempt to use an uninitialised REF INT value (detected in [] "SIMPLOUT" collateral-clause starting at "(" in this line).
Although admittedly it is a runtime error.
However if y is changed to 'INT y = x + 2;', essentially a "constant", then there is no runtime error:
$ a68g goto.a68
x is +1
y is +0