Am 18.10.2011 21:42, schrieb Sven Barth:
For anonymous functions you can take a look at Embarcadero's Delphi help
here:
http://docwiki.embarcadero.com/RADStudio/en/Anonymous_Methods_in_Delphi

The Embarcadero style of anonymous functions does not satify me.

  myFunc := function(x, y: Integer): Integer
  begin
    Result := x + y;
  end;

This is not easier than writing:

  function Bla(x, y: Integer): Integer
  begin
    Result := x + y;
  end;

  myfunc := @Bla;


I would prefer a style like

  myfunc := @function(x, y: Integer): Integer Result := x + y;

But this makes it hard to read. Of course it would be nice to have anonymous functions or even lambdas (think about integrated languages like LinQ). But maybe Pascals strength of easy readable code gets lost.

Michael
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to