[fpc-pascal] Procedural parameters
Adriaan van Os
adriaan at adriaan.biz
Sat Dec 14 19:22:25 CET 2024
Michael Van Canneyt via fpc-pascal wrote:
>
>
> On Sat, 14 Dec 2024, Adriaan van Os via fpc-pascal wrote:
>
>>
>> Macpascal and Iso pascal have procedural parameters, e.g.
>>
>> function A( function B: double): double;
>>
>> Is there a $modeswitch to allow this ? I searched "procedure
>> parameter" and "procedural parameter" in the Language Reference, but
>> could not find anything.
>
> As far as I know, the above is not allowed. you must declare the
> callback type explicitly.
It can in iso and macpascal mode. Read the Pascal standard.
> As far as I know, the above is not allowed. you must declare the callback type explicitly.
>
> TMyFunc = function : double;
>
> function A(B : TMyFunc): double;
>
> This is in line with 'declare before use': procedure parameter lists cannot be used to declare types.
>
> Similarly, you also cannot write:
> function A(B : (one,two,three)) : double;
Not really. The function type declaration is a Borland invention, not original Pascal.
Regards,
Adriaan van Os
More information about the fpc-pascal
mailing list