[fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

Michael Fuchs freepascal at ypa-software.de
Wed Oct 19 10:36:29 CEST 2011


Am 19.10.2011 10:16, schrieb Sven Barth:
>> I would prefer a style like
>>
>> myfunc := @function(x, y: Integer): Integer Result := x + y;
>
> And how would you create more complex functions? In Pascal code blocks
> are started with "begin" and ended with "end". I don't see a reason why
> anonymous methods should differ here.

Allow both, like it is already allowed in Pascal:

   if True then DoSomething;

   if True then begin
     DoSomething;
     DoSomethingMore;
     Etc;
   end;

If a function only contains one statement it is not a codeblock.

Michael





More information about the fpc-pascal mailing list