[fpc-devel] Delphi anonymous methods

Graeme Geldenhuys graeme at geldenhuys.co.uk
Mon Mar 4 01:15:53 CET 2013


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.


Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/




More information about the fpc-devel mailing list