Re: [fpc-devel] Question about Syntax: I there a reason for this design?

2014-09-22 Thread Boian Mitov
22, 2014 1:54 AM To: fpc-devel@lists.freepascal.org Subject: Re: [fpc-devel] Question about Syntax: I there a reason for this design? On 09/21/2014 06:36 PM, Boian Mitov wrote: I consider it a design bug that local functions can’t be passed as anonymous methods in Delphi. There is no reason

Re: [fpc-devel] Question about Syntax: I there a reason for this design?

2014-09-22 Thread Sven Barth
Am 22.09.2014 10:54 schrieb "Michael Schnell" : > > On 09/21/2014 06:36 PM, Boian Mitov wrote: >> >> I consider it a design bug that local functions can’t be passed as anonymous methods in Delphi. There is no reason for that not to be done, except that they did not bother. >> > ??? > Local functio

Re: [fpc-devel] Question about Syntax: I there a reason for this design?

2014-09-22 Thread Michael Schnell
On 09/21/2014 06:36 PM, Boian Mitov wrote: I consider it a design bug that local functions can't be passed as anonymous methods in Delphi. There is no reason for that not to be done, except that they did not bother. ??? Local functions can use local variables of the outer function. Same are

Re: [fpc-devel] Question about Syntax: I there a reason for this design?

2014-09-22 Thread Steve Hildebrandt
Am 21.09.2014 06:13, schrieb Jonas Maebe: On 21/09/14 08:10, Samuel Herzog wrote: But it's not accepted. *procedure* TFormThreading.Button1Click(Sender: TObject); *var* aTask: ITask; **procedure* *MyTask*; *begin* *sleep (3000); // 3 seconds* *ShowMessage ('Hello');*

Re: [fpc-devel] Question about Syntax: I there a reason for this design?

2014-09-21 Thread Boian Mitov
v.com --- -Original Message- From: Jonas Maebe Sent: Sunday, September 21, 2014 10:23 AM To: FPC developers' list Subject: Re: [fpc-devel] Question about Syntax: I there a reason for this design? [Jonas: anonymous methods and local

Re: [fpc-devel] Question about Syntax: I there a reason for this design?

2014-09-21 Thread Jonas Maebe
[Jonas: anonymous methods and local functions could use the same syntax] On 21/09/14 18:43, Boian Mitov wrote: > I used to think the same way, until I actually started to use anonymous > methods, and I realized what a full I used to be. > The simplest difference is that you can return anonymous me

Re: [fpc-devel] Question about Syntax: I there a reason for this design?

2014-09-21 Thread Boian Mitov
unday, September 21, 2014 3:13 AM To: FPC developers' list Subject: Re: [fpc-devel] Question about Syntax: I there a reason for this design? On 21/09/14 08:10, Samuel Herzog wrote: As you observed, anonymous methods and nested routines are essentially identical other than the syntax, and I

Re: [fpc-devel] Question about Syntax: I there a reason for this design?

2014-09-21 Thread Boian Mitov
--- From: Samuel Herzog Sent: Saturday, September 20, 2014 11:10 PM To: FPC developers' list Subject: [fpc-devel] Question about Syntax: I there a reason for this design? I was looking at the following example in DXE7 http://delphiaball.co.uk/ procedure TFormThreading.Button1Click(Sender: TO

Re: [fpc-devel] Question about Syntax: I there a reason for this design?

2014-09-21 Thread Sven Barth
On 21.09.2014 12:13, Jonas Maebe wrote: On 21/09/14 08:10, Samuel Herzog wrote: But it's not accepted. *procedure* TFormThreading.Button1Click(Sender: TObject); *var* aTask: ITask; **procedure* *MyTask*; *begin* *sleep (3000); // 3 seconds* *ShowMessage ('Hello');*

Re: [fpc-devel] Question about Syntax: I there a reason for this design?

2014-09-21 Thread Jonas Maebe
On 21/09/14 08:10, Samuel Herzog wrote: > But it's not accepted. > > *procedure* TFormThreading.Button1Click(Sender: TObject); > *var* > aTask: ITask; > > **procedure* *MyTask*; > *begin* > *sleep (3000); // 3 seconds* > *ShowMessage ('Hello');* >* end* > > begin* > //

[fpc-devel] Question about Syntax: I there a reason for this design?

2014-09-21 Thread Samuel Herzog
I was looking at the following example in DXE7 http://delphiaball.co.uk/ procedure TFormThreading.Button1Click(Sender: TObject); var aTask: ITask; begin // not a thread safe snippet aTask := TTask.Create (procedure () begin sleep (3000); // 3 seconds ShowMessage ('Hello'); end); aTask.Start; end;