[fpc-devel] Suggestion: reference counted objects

Dmitry Boyarintsev skalogryz.lists at gmail.com
Wed Sep 24 04:00:01 CEST 2014


On Tue, Sep 23, 2014 at 1:51 PM, silvioprog <silvioprog at gmail.com> wrote:

> On Tue, Sep 23, 2014 at 1:53 PM, Boian Mitov <mitov at mitov.com> wrote:
>
>>   It used to be compatible, however since we rewrote it to use anonymous
>> methods, and attributes (And reduced the code to 1/4 of the original size
>> in the process) ~2 years ago, the new versions are not any more Lazarus
>> compatible :-( .
>>
>
> :-(
>
> Currently I'm programming a lot in Java (for Android) and jQuery (for
> web), and I miss the dynamic methods in Object Pascal of Free Pascal
> (Delphi already has, which are anonymous methods) too.
>
> Nonproductive:
>
> [snip]
>
> Productive:
>
> procedure TApp.Create(Sender: TObject);
> begin
>   MyButton.SetOnClick(procedure Test; begin
>       Alert('Button clicked');
>   end);
> end;
>
> I have a lot of ideas to be implemented in two projects (Brook, dOpf) that
> I maintain. But unfortunately it will take a while to release the new
> version of the compiler (FPC 2.8), and this prevents me from continue
> working to release new versions of this projects.
>
>
Non productive sample is not quite accurate, since the event assignment is
typically handled by RTTI during an .lfm loading. Though for dynamically
created forms the assignment code indeed should be there.

About productive code. Should it look like this (note "Test" name is
removed from procedure declaration)?

procedure TApp.Create(Sender: TObject);
begin
  MyButton.SetOnClick(procedure; begin
      Alert('Button clicked');
  end);
end;

thanks,
Dmitry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20140923/e8d5f6e7/attachment.html>


More information about the fpc-devel mailing list