[fpc-pascal] Use a procedural type for declare a procedure\function

Michael Van Canneyt michael at freepascal.org
Thu Apr 20 11:40:11 CEST 2017



On Wed, 19 Apr 2017, Andrey M, Zubarev wrote:

> Hi All,
>
> Why can't use procedural type for declare a procedure\function?
> Why ever allow the exact same signature? It's uncomfortable
> Maybe it makes sense to introduce into the language such a possibility?
> For example such code:
>
> [code]
> type TMyCommand=function(arg1:TMyArg):TMyCommandResult
> begin
> ...
> end;

> command1 TMyCommand;
> begin
> ...
> end;

You can do this already using a macro

{$define mysig:=(arg1:TMyArg):TMyCommandResult}

type TMyCommand = function mysig;

function command1 mysig;


Michael.



More information about the fpc-pascal mailing list