[Oberon] Oxford Oberon-2 Compiler and local procedures
Martin Bishop
martinbishop at bellsouth.net
Thu Nov 27 18:29:12 MET 2008
Alexander Iljin wrote:
> 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?
Yes, but I never really got a clear answer (although the answer is clear
now :))
>
> 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".
>
Thanks, that clears it up.
> ---=====---
> Alexander
More information about the Oberon
mailing list