[fpc-pascal] assigning a local function to a var
Jonas Maebe
jonas.maebe at elis.ugent.be
Fri Jul 11 10:35:40 CEST 2008
On 11 Jul 2008, at 00:09, Marco van de Voort wrote:
>> Thus, I would ask of the devs, has this functionality been
>> considered?
>
> Yes. A solution for this problem is needed for Mac Pascal
> compatability.
No, it isn't. Mac Pascal only requires that you can declare a
procedure like this:
procedure test(function f(para1: longint): longint);
begin
end;
and that you then can pass the address of either local or global
functions as a parameter to this procedure. It does not require, or
indeed allow, assigning the address of a local function/procedure to a
procvar.
This furthermore only works for cases where the procvar type
definition appears directly in the function declaration, and not in
case you have a separate procvar declaration. I.e., in the following
case you can only pass procvars and the addresses of global function
to test:
type
tfun = function(para1: longint): longint;
procedure test(f: tfun);
begin
end;
Afaik it's also not Mac Pascal specific, but regular Standard Pascal
functionality.
Jonas
More information about the fpc-pascal
mailing list