[fpc-devel] Delphi anonymous methods

Marcos Douglas md at delfire.net
Mon Mar 4 13:26:18 CET 2013


On Mon, Mar 4, 2013 at 7:01 AM, Graeme Geldenhuys
<graeme at geldenhuys.co.uk> wrote:
> On 2013-03-04 01:47, Boian Mitov wrote:
>> vast improvements of the code and the readability.
>
> They are unreadable to me.
>
>> I recently started
>> rewriting our libraries with anonymous methods and that alone allowed for
>> cutting over 20000 lines of code
>
> Just my dropping method names? I doubt that.
>
> ps:
> You do know that the Object Pascal language already supports things like
> method pointers, so passing methods to a procedure common - plus it has
> the benefit that the method is well named (so you know what it should be
> doing).
>
> Anonymous methods seem to be exactly what existing method pointers are,
> but with the downside that they are obscure (no names to hint to what
> they do), and defined in the wrong place in code.
>
>
>> If you have never developed with them, (as was I), you never know what you
>> have been missing.
>
> This is what I am trying to find out. So far, with everything I have
> read and seen. I can do the same thing in code, using method pointers
> and it will be more structured code (with names and defined in the
> correct location in my unit]. I simply don't see a need for anonymous
> methods. Maybe other languages have them, because they didn't have the
> method pointer construct to start with?

+1

Marcos Douglas



More information about the fpc-devel mailing list