[Oberon] Bug? procedure variable in procedure call parameter
Volkert Barr
volkert at nivoba.de
Mon Mar 31 19:17:11 CEST 2014
Dear all,
i have a "problem" with the evaluation of a "procedure variable" used as parameter in a procedure call.
this case leads to a ABORT or TRAP in Line 1. Procedure variable is FunId.
BEGIN
(*1*) Texts.WriteRealFix(W, FunId(1.0), 5,3);
...
END...
this case with the dummy assigment to "Test" gives the correct output
BEGIN
Test := FunId(1.0);
Texts.WriteRealFix(W, FunId(1.0), 5,3);
...
END...
The complete code can be found in the appended Module
Bug or Feature??
I use the Oberon-Image (RISC.IMG) from Paul Reed´s "Project Oberon"-Website with the nice "Oberon RISC Emulator" from Peter De Wachter (thanks for it).
BW,
Volkert
----
MODULE Scratch;
IMPORT Texts, Oberon;
TYPE Function = PROCEDURE (x:REAL) : REAL;
VAR W: Texts.Writer;
FunId : Function;
PROCEDURE RealId(x:REAL):REAL;
BEGIN
RETURN x
END RealId;
PROCEDURE DoIt*;
VAR
Test : REAL;
BEGIN
Test := FunId(1.0);
Texts.WriteRealFix(W, FunId(1.0), 5,3);
Texts.WriteRealFix(W, RealId(1.0), 5,3);
Texts.WriteLn(W);
Texts.Append(Oberon.Log, W.buf)
END DoIt;
BEGIN Texts.OpenWriter(W);
FunId := RealId;
END Scratch.
More information about the Oberon
mailing list