Re: Procedural parameters

Michael Van Canneyt via fpc-pascal <[email protected]>
Newsgroups gmane.comp.compilers.free-pascal.general
Message-ID <[email protected]>

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.

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;

>
> Also, I wonder if "ISOPROGRAMPARAS" in the Programmer's Guide is spelled 
> correctly.

It is, as that is what is used in the compiler: globtype.pas:736

Michael.
_______________________________________________
fpc-pascal maillist  -  [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.