Anonymous procedures (Was: Re: [fpc-devel] for-in-index loop)

kyan alfasud.ti at gmail.com
Sat Jan 26 15:59:23 CET 2013


On Sat, Jan 26, 2013 at 4:57 PM, Sven Barth <pascaldragon at googlemail.com> wrote:
> On 26.01.2013 15:52, Alexander Klenin wrote:
>>
>> On Sun, Jan 27, 2013 at 12:26 AM, Paul Ishenin <paul.ishenin at gmail.com>
>> wrote:
>>>
>>> 26.01.13, 6:57, Alexander Klenin пишет:
>>>
>>> Why to invent a new solution if Delphi already have one:
>>>
>>> http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/devcommon/anonymousmethods_xml.html
>>>
>>
>> Of course, the Delphi-compatible implementation is a basis --
>> I did not even mention it, because I thought it is obvious.
>> (Although I would still like to devise some solution for using
>> closures for events --
>> "IDE does not recognize them" seems quite a weak obstacle to me).
>>
>
> I assume this is because anonymous functions are not plain methods. Thus
> they are not compatible with TMethod (the type behind "procedure/function of
> object"). They are instead based on a different (internal) type.

Please take a look at this:
http://blog.barrkel.com/2010/01/using-anonymous-methods-in-method.html



More information about the fpc-devel mailing list