[fpc-devel] Suggestion: reference counted objects

Dmitry Boyarintsev skalogryz.lists at gmail.com
Wed Sep 24 04:39:42 CEST 2014


That's exactly what I wanted to confirm - no name - for an anonymous
function.

I'm sure eventually the development society, will discourage the use of
anonymous functions (just like unnamed constants are considered to be a bad
pattern). Thus the only thing that would remain welcomed are closures -
copying the execution context for further invoke of a function.

thanks,
Dmitry

On Tue, Sep 23, 2014 at 10:14 PM, Boian Mitov <mitov at mitov.com> wrote:

>   Actually the Delphi compatible code would be :
>
>  procedure TApp.Create(Sender: TObject);
> begin
>   MyButton.SetOnClick(
>     procedure
>     begin
>       Alert('Button clicked');
>     end );
> end;
>
> There is no comas in the procedure declaration.
> We have even created multicast anonymous methods in Mitov.Runtime so you
> can add more than one anonymous methods to an event.
>
>  procedure TApp.Create(Sender: TObject);
> begin
>   MyButton.OnClick.Add(
>     procedure
>     begin
>       Alert('Button clicked and called me');
>     end )
>   .Add(
>     procedure
>     begin
>       Alert('Button clicked and called me too');
>     end );
> end;
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20140923/c1292aeb/attachment.html>


More information about the fpc-devel mailing list