[Oberon] Oxford Oberon-2 Compiler and local procedures
Alexander Iljin
ajsoft.gm at gmail.com
Thu Nov 27 05:52:35 MET 2008
Hello!
MB> I translated some Pascal code for "deep binding" (aka closures) into Oberon.
...
MB> Does anyone have an idea as to why oo2c seems to compile the code just
MB> fine, and obc does not?
This is clearly a bug in oo2c. Oberon does not support closures this
way. Didn't we discuss this recently?
There is no way procedure B will be able to access its context
(variable I in this case) when the procedure A terminates. The
compiler does not check if you only use the pointer locally,
therefore it must only allow top-level procedures to be pointer
values.
The quoted scopes reference have nothing to do with this issue.
Here's a quote from "Oberon-2 Report" by N.Wirth, section 6.5
"Procedure types": Procedure assigned to a pointer "... must not be
a predeclared or type-bound nor may it be local to another
procedure".
---=====---
Alexander
More information about the Oberon
mailing list