[fpc-devel] Delphi anonymous methods

Marcos Douglas md at delfire.net
Mon Mar 4 02:30:40 CET 2013


On Sun, Mar 3, 2013 at 9:15 PM, Graeme Geldenhuys
<graeme at geldenhuys.co.uk> wrote:
> On 2013-03-02 19:03, vrt277 wrote:
>>
>> I want to implement support of Delphi anonymous methods for fpc.
>
>
> Just curious... why must such a feature be allowed in Object Pascal?
> Referring to the recent "butchering of the Object Pascal language"
> thread we had recently in fpc-pascal.
>
> It was clearly stated in the past that FPC will not support the C/C++
> language feature of declaration a variable in-line inside code blocks,
> but only in var sections.
>
> Example of not allowed code:
>
>   for i: integer = 0 to 10 do
>   begin
>   end;
>
> or
>
>   var
>     s: string;
>   begin
>     s := 'string'
>     ...
>     i: integer := 0;     // I must be declared in var section instead
>     Inc(i, 5);
>     ...
>   end;
>
>
> >From what I can see, anonymous methods are just like the above code...
> allowing a declaration of a procedure/method in-line inside a code block
> where in shouldn't belong. It is very, very un-Pascal like. The end
> result is unreadable code, probably hard to debug etc.

+1

Marcos Douglas



More information about the fpc-devel mailing list