[fpc-pascal] Caller agnostic procedure variables

Adriaan van Os fpc at microbizz.nl
Wed Feb 16 11:51:15 CET 2022


Sven Barth via fpc-pascal wrote:

>     "However assigning a nested function variable to a function
>     reference is much harder.
>     Assigning a function reference to a nested function variable is hard
>     as well. "

"is nested" means that the actual function passed can be either global or local. ISO Pascal style 
function parameters are implicitely "is nested". The formal function reference for an "is nested" 
function contains space for both a function address and a context pointer. The context pointer is 
NIL if the actual function is declared global. For local functions, the context pointer typically 
contains a dynamic link chain pointer, required to address variables in the actual link frame. For 
object methods, the context pointer is the SELF pointer.

Regards,

Adriaan van Os



More information about the fpc-pascal mailing list