Re: [fpc-devel] Delphi anonymous methods

2013-03-07 Thread Alexander Shishkin
03.03.2013 2:22, Sven Barth пишет: On 02.03.2013 20:55, Sven Barth wrote: Also there are open questions which require brainstorm: 1. Does Pascal needs other implementation of closures which is different from anonymous methods implementation? I would say no. After all the method implementation

Re: [fpc-devel] Delphi anonymous methods

2013-03-06 Thread Michael Schnell
On 03/05/2013 08:52 PM, Graeme Geldenhuys wrote: Good thing is, most of these are kept in the 'delphi' compiler mode. The 'objfpc' mode normally get some more pascal love. +1 AFAIK there is an Apple specific Objective Pascal mode, as well. I think it's really nice to have multiple compilers

Re: [fpc-devel] Delphi anonymous methods

2013-03-06 Thread Michael Schnell
On 03/06/2013 01:54 AM, Frank Church wrote: I have observed a lot of Delphi developers who have written code that needs or depends on the features like anonymous methods, generics, RTTI or Strings :-[ give up porting to FPC because it proved too difficult, but then it turns out those libraries

Re: [fpc-devel] Delphi anonymous methods

2013-03-06 Thread Sven Barth
Am 06.03.2013 11:57, schrieb Michael Schnell: On 03/05/2013 08:52 PM, Graeme Geldenhuys wrote: Good thing is, most of these are kept in the 'delphi' compiler mode. The 'objfpc' mode normally get some more pascal love. +1 AFAIK there is an Apple specific Objective Pascal mode, as well. I

Re: [fpc-devel] Delphi anonymous methods

2013-03-06 Thread Michael Schnell
On 03/06/2013 01:45 PM, Sven Barth wrote: There is a mode that's compatible to Mac Pascal, but the Objective Pascal is independant of the mode, but is triggered by a modeswitch (as it was specially developed by the FPC and the Mac Pascal communities). Would it not be nice and more

Re: [fpc-devel] Delphi anonymous methods

2013-03-06 Thread Sven Barth
Am 06.03.2013 14:35, schrieb Michael Schnell: On 03/06/2013 01:45 PM, Sven Barth wrote: There is a mode that's compatible to Mac Pascal, but the Objective Pascal is independant of the mode, but is triggered by a modeswitch (as it was specially developed by the FPC and the Mac Pascal

Re: [fpc-devel] Delphi anonymous methods

2013-03-06 Thread Graeme Geldenhuys
On 2013-03-05 13:02, Sven Barth wrote: Two words: backwards compatibility. To Turbo Pascal yes (ie: tp mode), but surely not ObjFPC? Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/

Re: [fpc-devel] Delphi anonymous methods

2013-03-06 Thread Michael Schnell
On 03/06/2013 02:37 PM, Sven Barth wrote: What exactly do you mean? we already have: {$MODE FPC} {$MODE OBTP} {$MODE DELPHI} {$MODE OBJFPC} {$MODE OBJMAC} if {$MODE OBJMAC} not already is for objective Pascal there could be something like {$MODE OBJECTIVE} -Michael

Re: [fpc-devel] Delphi anonymous methods

2013-03-06 Thread Sven Barth
Am 06.03.2013 15:19, schrieb Graeme Geldenhuys: On 2013-03-05 13:02, Sven Barth wrote: Two words: backwards compatibility. To Turbo Pascal yes (ie: tp mode), but surely not ObjFPC? You must not forget that mode ObjFPC isn't the youngest one either. If we'd freshly design that mode I'd agree

Re: [fpc-devel] Delphi anonymous methods

2013-03-06 Thread Thaddy
{$MODE SUBJECTIVE} is more appropriate in this discussion. But i am by -first - education a political scientist. On 6-3-2013 15:44, Michael Schnell wrote: On 03/06/2013 02:37 PM, Sven Barth wrote: What exactly do you mean? we already have: {$MODE FPC} {$MODE OBTP} {$MODE DELPHI} {$MODE

Re: [fpc-devel] Delphi anonymous methods

2013-03-06 Thread Roberto P.
{$MODE MINE} would suit as well :-) 2013/3/6 Thaddy tha...@thaddy.com {$MODE SUBJECTIVE} is more appropriate in this discussion. But i am by -first - education a political scientist. On 6-3-2013 15:44, Michael Schnell wrote: On 03/06/2013 02:37 PM, Sven Barth wrote: What exactly do

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Paul Ishenin
05.03.13, 15:57, Michael Van Canneyt wrote: With such an attitude you should remove objfpc (and perhaps all non-delphi modes) alltogether, and rename Free Pascal to Free Delphi. The situation with FPC and Delphi is very like to what had happened with browsers. Every had it own vision of CSS,

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Sven Barth
Am 05.03.2013 07:56, schrieb Paul Ishenin: 05.03.13, 14:10, Sven Barth wrote: ObjFPC mode is not compatible with mode Delphi, because of conscious decisions. Think for example about the @ for procedure variable assignments here or the use of symbolic operator names for overload declarations,

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Michael Van Canneyt
On Tue, 5 Mar 2013, Paul Ishenin wrote: 05.03.13, 15:57, Michael Van Canneyt wrote: With such an attitude you should remove objfpc (and perhaps all non-delphi modes) alltogether, and rename Free Pascal to Free Delphi. The situation with FPC and Delphi is very like to what had happened with

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Michael Van Canneyt
On Tue, 5 Mar 2013, Sven Barth wrote: Am 05.03.2013 07:56, schrieb Paul Ishenin: 05.03.13, 14:10, Sven Barth wrote: ObjFPC mode is not compatible with mode Delphi, because of conscious decisions. Think for example about the @ for procedure variable assignments here or the use of symbolic

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Paul Ishenin
05.03.13, 16:30, Sven Barth wrote: Just to say one thing clear: I will NOT drop FPC's generic implementation and I'll revert every commit that tries to do so, because Sven, relax - FPC is not your own project and not mine. We can't simple commit or revert what we want. not only do we have

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Michael Van Canneyt
On Tue, 5 Mar 2013, Paul Ishenin wrote: 05.03.13, 16:30, Sven Barth wrote: Just to say one thing clear: I will NOT drop FPC's generic implementation and I'll revert every commit that tries to do so, because Sven, relax - FPC is not your own project and not mine. We can't simple commit or

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Sven Barth
Am 05.03.2013 09:59, schrieb Paul Ishenin: Just to say one thing clear: I will NOT drop FPC's generic implementation and I'll revert every commit that tries to do so, because Sven, relax - FPC is not your own project and not mine. We can't simple commit or revert what we want. I'm sorry

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Graeme Geldenhuys
On 2013-03-04 20:33, Howard Page-Clark wrote: You can simulate this in FPC as well as TP by using a local typed constant. e.g. function GetValue: integer; const value: integer = 0; begin Inc(value); Result:= value; end; I've seen this before, and always been baffled by this.

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Michael Van Canneyt
On Tue, 5 Mar 2013, Graeme Geldenhuys wrote: On 2013-03-04 20:33, Howard Page-Clark wrote: You can simulate this in FPC as well as TP by using a local typed constant. e.g. function GetValue: integer; const value: integer = 0; begin Inc(value); Result:= value; end; I've seen this

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Sven Barth
Am 05.03.2013 10:20, schrieb Graeme Geldenhuys: On 2013-03-04 20:33, Howard Page-Clark wrote: You can simulate this in FPC as well as TP by using a local typed constant. e.g. function GetValue: integer; const value: integer = 0; begin Inc(value); Result:= value; end; I've seen this

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Paul Ishenin
05.03.13, 17:14, Sven Barth wrote: Just for your information: I will implement generic methods will full requirement for generic and specialize in mode ObjFPC (and no, you can't change my opinion on that). Yes, I didn't expect my mails will suddenly change your opinion. And even if they

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Sven Barth
Am 05.03.2013 10:41, schrieb Paul Ishenin: 05.03.13, 17:14, Sven Barth wrote: Just for your information: I will implement generic methods will full requirement for generic and specialize in mode ObjFPC (and no, you can't change my opinion on that). Yes, I didn't expect my mails will suddenly

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Graeme Geldenhuys
On 2013-03-05 09:12, Michael Van Canneyt wrote: You may think that Delphi is the best thing since sliced bread, but not everyone thinks so. There are several people on the list that do not like what Delphi is doing to the pascal language. +1000 I think Embarcadero is butchering the Object

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Paul Ishenin
05.03.13, 17:12, Michael Van Canneyt wrote: Of course we can, if you violate a basic rule: do not undo other peoples work. Can you imagine me or anybody other in FPC team who do so without total agreement? It does not split. It offers people the choice. Again we see one thing from

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Michael Van Canneyt
On Tue, 5 Mar 2013, Paul Ishenin wrote: Think about component and applications developers who need to care about FPC and Delphi. Less incompatibilities FPC will have more 3rd party components and applications it will get. For this, mode delphi exists. I remember author of Total

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Sven Barth
Am 05.03.2013 10:53, schrieb Graeme Geldenhuys: On 2013-03-05 09:12, Michael Van Canneyt wrote: You may think that Delphi is the best thing since sliced bread, but not everyone thinks so. There are several people on the list that do not like what Delphi is doing to the pascal language. +1000

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Michael Van Canneyt
On Tue, 5 Mar 2013, Paul Ishenin wrote: 05.03.13, 17:12, Michael Van Canneyt wrote: Of course we can, if you violate a basic rule: do not undo other peoples work. Can you imagine me or anybody other in FPC team who do so without total agreement? I hope not :) It does not split. It

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Henry Vermaak
On Tue, Mar 05, 2013 at 10:12:04AM +0100, Michael Van Canneyt wrote: You may think that Delphi is the best thing since sliced bread, but not everyone thinks so. And with the attitude of, e.g. Boian, we see that it's simply too hard to please hard-core delphi fanboys. They're all take and no

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Paul Ishenin
05.03.13, 17:55, Sven Barth wrote: @Paul: see? :) I see you, Graeme, Michael and probably some more 5-6 developers. Best regards, Paul Ishenin ___ fpc-devel maillist - fpc-devel@lists.freepascal.org

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Bernd Mueller
Paul Ishenin wrote: I remember author of Total Commander who had failed to port his project to FPC + Laz because of many incompatilities in both projects. IMHO, you are not right. the 64-bit version seems to be written in FPC/Lazarus: The string FPC 2.5.1 [2011/12/03] for x86_64 - Win64

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Sven Barth
Am 05.03.2013 11:05, schrieb Henry Vermaak: On Tue, Mar 05, 2013 at 10:12:04AM +0100, Michael Van Canneyt wrote: You may think that Delphi is the best thing since sliced bread, but not everyone thinks so. And with the attitude of, e.g. Boian, we see that it's simply too hard to please

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Marco van de Voort
In our previous episode, Sven Barth said: when Delphi announced them they had much more (you know of course). That was more a prototype of generics. But inspite of that we did not drop our own implementation. Just to say one thing clear: I will NOT drop FPC's generic implementation and

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Alexander Klenin
On Tue, Mar 5, 2013 at 9:10 PM, Paul Ishenin paul.ishe...@gmail.com wrote: 05.03.13, 17:55, Sven Barth wrote: I see you, Graeme, Michael and probably some more 5-6 developers. The level of Delphi compatibility vs. syntax quality is, as always in engineering, a matter of compromise and

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Alexander Klenin
On Tue, Mar 5, 2013 at 10:24 PM, Marco van de Voort mar...@stack.nl wrote: Just to say one thing clear: I will NOT drop FPC's generic implementation and I'll revert every commit that tries to do so, because not only do we have to keep backwards compatibility, but the Delphi syntax is a

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Marco van de Voort
In our previous episode, Alexander Klenin said: not only do we have to keep backwards compatibility, but the Delphi syntax is a nightmare to parse. But you need to anyway because of mode delphi, so what is the point? It is hard to parse for humans as well as for the compiler. That's a

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Michael Fuchs
Am 05.03.2013 10:25, schrieb Michael Van Canneyt: I've seen this before, and always been baffled by this. How can you increment a constant? If you can, it is then a variable, no? A leftover from the TP days. A typed constant acts as an initialized variable. You can disable this construct

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Michael Fuchs
Am 05.03.2013 11:10, schrieb Paul Ishenin: @Paul: see? :) I see you, Graeme, Michael and probably some more 5-6 developers. That is the problem with mailing lists. Not everybody sends a mail, just saying +1 from me too. And so it could be probably some more 500-600 developers. And btw:

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Marcos Douglas
On Tue, Mar 5, 2013 at 7:10 AM, Paul Ishenin paul.ishe...@gmail.com wrote: 05.03.13, 17:55, Sven Barth wrote: @Paul: see? :) I see you, Graeme, Michael and probably some more 5-6 developers. So now we have 7! ;-) I want to keep the language sane too. Regards, Marcos Douglas

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Sven Barth
Am 05.03.2013 12:44, schrieb Michael Fuchs: Am 05.03.2013 10:25, schrieb Michael Van Canneyt: I've seen this before, and always been baffled by this. How can you increment a constant? If you can, it is then a variable, no? A leftover from the TP days. A typed constant acts as an initialized

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Sven Barth
Am 05.03.2013 12:29, schrieb Alexander Klenin: This is why I propose the following plan: 1) Implement Delphi-like anonymous functions syntax, without closures 2) Implement Delphi-like by-reference closures 3) Implement ObjFPC-specific named closures with explicit by-value/by reference options

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Sven Barth
Am 05.03.2013 12:24, schrieb Marco van de Voort: In our previous episode, Sven Barth said: when Delphi announced them they had much more (you know of course). That was more a prototype of generics. But inspite of that we did not drop our own implementation. Just to say one thing clear: I will

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Alexander Klenin
On Wed, Mar 6, 2013 at 12:16 AM, Sven Barth pascaldra...@googlemail.com wrote: SomeVar := SomeFuncSomething - SomeTypeSomething.SomeMethod * SomeOtherTypeSomething.SomeMethodSomething; === example end === while this will be much easier to implement: === example begin === SomeVar :=

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Sven Barth
Am 05.03.2013 14:23, schrieb Alexander Klenin: On Wed, Mar 6, 2013 at 12:16 AM, Sven Barth pascaldra...@googlemail.com wrote: SomeVar := SomeFuncSomething - SomeTypeSomething.SomeMethod * SomeOtherTypeSomething.SomeMethodSomething; === example end === while this will be much easier to

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Mattias Gaertner
Sven Barth pascaldra...@googlemail.com hat am 5. März 2013 um 14:27 geschrieben: [...] Please note that I wouldn't have choosen round brackets either (potential conflicts with type casting) ? Can you give an example? Mattias ___ fpc-devel maillist

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Alexander Klenin
On Wed, Mar 6, 2013 at 12:27 AM, Sven Barth pascaldra...@googlemail.com wrote: I don't know why the one who first implemented them chose them, but now the reason is backwards compatibility. Please note that I wouldn't have choosen round brackets either (potential conflicts with type casting)

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Sven Barth
Am 05.03.2013 14:50, schrieb Alexander Klenin: On Wed, Mar 6, 2013 at 12:27 AM, Sven Barth pascaldra...@googlemail.com wrote: I don't know why the one who first implemented them chose them, but now the reason is backwards compatibility. Please note that I wouldn't have choosen round brackets

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Sven Barth
Am 05.03.2013 14:41, schrieb Mattias Gaertner: Sven Barth pascaldra...@googlemail.com hat am 5. März 2013 um 14:27 geschrieben: [...] Please note that I wouldn't have choosen round brackets either (potential conflicts with type casting) ? Can you give an example? Forget what I wrote... As I've

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Paul Ishenin
05.03.13, 21:00, Marcos Douglas пишет: So now we have 7! ;-) I want to keep the language sane too. I wrote not about sane/insane. Delphi adds features to pascal the way they want - this is reality. We can't do anything with this. If they add a feature not the sane way we can't undo their

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Florian Klaempfl
Am 05.03.2013 11:10, schrieb Paul Ishenin: 05.03.13, 17:55, Sven Barth wrote: @Paul: see? :) I see you, Graeme, Michael and probably some more 5-6 developers. Even if those are the only ones, from the beginning, FPC tried to support all niches. And if someone maintaines a certain niche,

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Marcos Douglas
On Tue, Mar 5, 2013 at 11:46 AM, Paul Ishenin paul.ishe...@gmail.com wrote: 05.03.13, 21:00, Marcos Douglas пишет: So now we have 7! ;-) I want to keep the language sane too. I wrote not about sane/insane. Delphi adds features to pascal the way they want - this is reality. We can't do

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread waldo kitty
On 3/4/2013 15:33, Howard Page-Clark wrote: On 04/03/13 6:34, waldo kitty wrote: i'm trying to understand what you mean by Pascal don't allows to create static variables inside function like in c-like languages. i've done something that i think is what you speak of but it was in Borland's

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Boian Mitov
Subject: Re: [fpc-devel] Delphi anonymous methods And with the attitude of, e.g. Boian, we see that it's simply too hard to please hard-core delphi fanboys. They're all take and no give. I look forward to the day when the fpc developers will realise that playing eternal catch-up is never going to work

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Boian Mitov
: Tuesday, March 05, 2013 3:30 AM To: FPC developers' list Subject: Re: [fpc-devel] Delphi anonymous methods It is hard to parse for humans as well as for the compiler. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Graeme Geldenhuys
On 2013-03-05 15:24, Marcos Douglas wrote: Why follow the Delphi even knowing that is the wrong way to implement something? Because like the FPC team have said a million times to me because they follow Delphi blindly, and WILL do everything to stay delphi compatible. Good thing is, most

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Henry Vermaak
On Tue, Mar 05, 2013 at 09:56:21AM -0800, Boian Mitov wrote: Hi Henry, Interesting that you consider me a Delphi fanboy :-D . I don't like it much, but I surely love the anonymous methods :-D . I love the C++11 implementation of anonymous methods more however, but I hate the lack of

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Boian Mitov
--- Mitov Software www.mitov.com --- -Original Message- From: Henry Vermaak Sent: Tuesday, March 05, 2013 2:20 PM To: FPC developers' list Subject: Re: [fpc-devel] Delphi anonymous methods You sure have a lot of smiley faces

Re: [fpc-devel] Delphi anonymous methods

2013-03-05 Thread Frank Church
I have observed a lot of Delphi developers who have written code that needs or depends on the features like anonymous methods, generics, RTTI give up porting to FPC because it proved too difficult, but then it turns out those libraries could greatly enhance FPC usage. So I think this bullet must

Re: [fpc-devel] Delphi anonymous methods

2013-03-04 Thread Michael Fuchs
Am 04.03.2013 01:15, schrieb Graeme Geldenhuys: [...] It was clearly stated in the past that FPC will not support the C/C++ language feature of declaration a variable in-line inside code blocks, but only in var sections. Example of not allowed code: for i: integer = 0 to 10 do begin

Re: [fpc-devel] Delphi anonymous methods

2013-03-04 Thread Marco van de Voort
In our previous episode, Graeme Geldenhuys said: I want to implement support of Delphi anonymous methods for fpc. Just curious... why must such a feature be allowed in Object Pascal? In Delphi, synchronization primitives like queue() and synchronize() have been adapted to work with them,

Re: [fpc-devel] Delphi anonymous methods

2013-03-04 Thread Marco van de Voort
In our previous episode, Boian Mitov said: Or even more drastic example like this one: Exit( AAttrItem.GetInstance().ComponentEditor.Create( Component, Designer )); end; Try to write this without anonymous methods ;-) :-D . Am I the only one who is reminded of Turbo Vision

Re: [fpc-devel] Delphi anonymous methods

2013-03-04 Thread Graeme Geldenhuys
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 2 lines of code Just my dropping method names? I doubt that.

Re: [fpc-devel] Delphi anonymous methods

2013-03-04 Thread Graeme Geldenhuys
On 2013-03-04 03:59, Alexander Klenin wrote: Because computer science is advancing, and there is a limit after which programming language can not ignore those advancements and stay relevant. Sure, I understand that. I just haven't seen an example that explains why it is needed. Kind of why I

Re: [fpc-devel] Delphi anonymous methods

2013-03-04 Thread Graeme Geldenhuys
On 2013-03-04 09:24, Marco van de Voort wrote: In Delphi, synchronization primitives like queue() and synchronize() have been adapted to work with them, so they are actually more used than some other new features. Sure, just like Delphi implemented Advanced Records, when the Object type

Re: [fpc-devel] Delphi anonymous methods

2013-03-04 Thread Graeme Geldenhuys
On 2013-03-04 04:54, Boian Mitov wrote: In this case, not only you save declaration, you save the need to write a whole new class just for the task. All my code live in classes already, so I would simply have benefited by having a properly defined method. Then pass the method pointer to the

Re: [fpc-devel] Delphi anonymous methods

2013-03-04 Thread Michael Schnell
On 03/04/2013 11:17 AM, Graeme Geldenhuys wrote: Was advanced records really needed, NO. As discussed in another thread: It does make sense to allow for a kind of class that does not need to reside on the heap and, (residing on the stack or global space) does not need instantiation to gain

Re: [fpc-devel] Delphi anonymous methods

2013-03-04 Thread Marco van de Voort
In our previous episode, Graeme Geldenhuys said: In Delphi, synchronization primitives like queue() and synchronize() have been adapted to work with them, so they are actually more used than some other new features. Sure, just like Delphi implemented Advanced Records, when the Object

Re: [fpc-devel] Delphi anonymous methods

2013-03-04 Thread Aleksa Todorovic
On Mon, Mar 4, 2013 at 11:01 AM, Graeme Geldenhuys gra...@geldenhuys.co.ukwrote: 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

Re: [fpc-devel] Delphi anonymous methods

2013-03-04 Thread Graeme Geldenhuys
On 2013-03-04 10:27, Michael Schnell wrote: It does make sense to allow for a kind of class that does not need to reside on the heap and, (residing on the stack or global space) And that is exactly what the Object type [already] does... and was introduced into the language in Turbo Pascal

Re: [fpc-devel] Delphi anonymous methods

2013-03-04 Thread Michael Schnell
On 03/04/2013 11:50 AM, Graeme Geldenhuys wrote: I still use the Object type to this day for performance or ease of use. AFAIK, some of my colleagues do same. For me the triple choice of a class, record and object notation for a type defining a combination of data and associated functions is

Re: [fpc-devel] Delphi anonymous methods

2013-03-04 Thread Martin
On 04/03/2013 04:54, Boian Mitov wrote: Here is example: Parallel execution with selection of executor: for i := 0 to AMaxScaleIndex - 1 do begin APerIterationLocations.Add( TRTDynamicListTVLImageRect.Create() ); AExecutionTask.Add( AExecutor.Execute( procedure() begin

Re: [fpc-devel] Delphi anonymous methods

2013-03-04 Thread Martin
On 04/03/2013 05:00, Boian Mitov wrote: One thing for sure, I probably will very much never need to declare TThread inherited classes. I can use a single anonymous method for that, thanks to the ability of the anonymous method to capture local and member variables. This is something not doable

Re: [fpc-devel] Delphi anonymous methods

2013-03-04 Thread Martin
On 04/03/2013 05:57, Alexander Klenin wrote: On Mon, Mar 4, 2013 at 2:38 PM, Martin laza...@mfriebe.de wrote: Closures, do not need to be written/declared in the middle of other code (in-line) Strictly speaking, they do not. However, if the closures are required to be named, their expressive

Re: [fpc-devel] Delphi anonymous methods

2013-03-04 Thread Martin
On 04/03/2013 06:06, Boian Mitov wrote: It may be a good idea to analyze the current Delphi implementation. In essence the anonymous method expands to a class and interface. The interface Execute method has the parameters of the anonymous function. and the corresponding interface has the

Re: [fpc-devel] Delphi anonymous methods

2013-03-04 Thread Alexander Klenin
On Mon, Mar 4, 2013 at 10:35 PM, Martin laza...@mfriebe.de wrote: On 04/03/2013 06:06, Boian Mitov wrote: It may be a good idea to analyze the current Delphi implementation. In essence the anonymous method expands to a class and interface. The interface Execute method has the parameters of

Re: [fpc-devel] Delphi anonymous methods

2013-03-04 Thread Mattias Gaertner
On Mon, 04 Mar 2013 11:17:53 + Martin laza...@mfriebe.de wrote: On 04/03/2013 04:54, Boian Mitov wrote: Here is example: Parallel execution with selection of executor: for i := 0 to AMaxScaleIndex - 1 do begin APerIterationLocations.Add( TRTDynamicListTVLImageRect.Create() );

Re: [fpc-devel] Delphi anonymous methods

2013-03-04 Thread Michael Van Canneyt
On Mon, 4 Mar 2013, Mattias Gaertner wrote: On Mon, 04 Mar 2013 11:17:53 + Martin laza...@mfriebe.de wrote: On 04/03/2013 04:54, Boian Mitov wrote: Here is example: Parallel execution with selection of executor: for i := 0 to AMaxScaleIndex - 1 do begin APerIterationLocations.Add(

Re: [fpc-devel] Delphi anonymous methods

2013-03-04 Thread Sven Barth
Am 04.03.2013 13:23, schrieb Michael Van Canneyt: On Mon, 4 Mar 2013, Mattias Gaertner wrote: On Mon, 04 Mar 2013 11:17:53 + Martin laza...@mfriebe.de wrote: On 04/03/2013 04:54, Boian Mitov wrote: Here is example: Parallel execution with selection of executor: for i := 0 to

Re: [fpc-devel] Delphi anonymous methods

2013-03-04 Thread Michael Van Canneyt
On Mon, 4 Mar 2013, Sven Barth wrote: Am 04.03.2013 13:23, schrieb Michael Van Canneyt: On Mon, 4 Mar 2013, Mattias Gaertner wrote: On Mon, 04 Mar 2013 11:17:53 + Martin laza...@mfriebe.de wrote: On 04/03/2013 04:54, Boian Mitov wrote: Here is example: Parallel execution with

Re: [fpc-devel] Delphi anonymous methods

2013-03-04 Thread Martin
On 04/03/2013 12:51, Sven Barth wrote: If you guys would read what I wrote in one of my first answers to Vasiliy in this thread than you would know that I want him to implement this possiblity as well... but after all, who reads the mails of some strange computer science student who just

Re: [fpc-devel] Delphi anonymous methods

2013-03-04 Thread Sven Barth
Am 04.03.2013 01:15, schrieb Graeme Geldenhuys: On 2013-03-02 19:03, vrt277 wrote: I want to implement support of Delphi anonymous methods for fpc. Just curious... why must such a feature be allowed in Object Pascal? Referring to the recent butchering of the Object Pascal language thread we

Re: [fpc-devel] Delphi anonymous methods

2013-03-04 Thread Alexander Klenin
On Mon, Mar 4, 2013 at 10:34 PM, Martin laza...@mfriebe.de wrote: Nevertheless, I agree what the implementation plan can be detailed even further: 1) Anonymous procedures *without* closures -- basically, just another syntax for nested procedures. That might be interested for mode Delphi No,

Re: [fpc-devel] Delphi anonymous methods

2013-03-04 Thread Graeme Geldenhuys
On 2013-03-04 11:17, Martin wrote: I added: - the name Bar - Used is at reference - the keyword closure The above code would then create the exact same closure, as your code does. And it does not need an anonymous method. +1 Much better solution, an in my opinion, much easier to

Re: [fpc-devel] Delphi anonymous methods

2013-03-04 Thread Graeme Geldenhuys
On 2013-03-04 13:05, Michael Van Canneyt wrote: And the first to use anonymous functions in FPC distributed code, I will personally make him eat his keyboard. Without pepper and salt. Thank you!! :) Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal

Re: [fpc-devel] Delphi anonymous methods

2013-03-04 Thread Graeme Geldenhuys
Thanks for taking the time with your detailed explanation. Regards, G. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel

Re: [fpc-devel] Delphi anonymous methods

2013-03-04 Thread Michael Van Canneyt
On Tue, 5 Mar 2013, Alexander Klenin wrote: 4) With both lambda and as syntax: ATree.VisitPreorder(lambda TVisitor as X + 5); Now, my argument is that (2) does indeed have only a marginal advantage over (1), but (4) is powerful enough to really make functional-style programming practically

Re: [fpc-devel] Delphi anonymous methods

2013-03-04 Thread Mattias Gaertner
On Mon, 4 Mar 2013 15:28:07 +0100 (CET) Michael Van Canneyt mich...@freepascal.org wrote: [...] I play chess. The rules of chess have not evolved in a long time. It doesn't make the game less popular or interesting to those that play it. Actually, yes it does. ;) I dare you to propose a new

Re: [fpc-devel] Delphi anonymous methods

2013-03-04 Thread Martin
On 04/03/2013 14:09, Alexander Klenin wrote: On Mon, Mar 4, 2013 at 10:34 PM, Martin laza...@mfriebe.de wrote: Nevertheless, I agree what the implementation plan can be detailed even further: 1) Anonymous procedures *without* closures -- basically, just another syntax for nested procedures.

Re: [fpc-devel] Delphi anonymous methods

2013-03-04 Thread Sven Barth
Am 04.03.2013 15:42, schrieb Martin: but (4) is powerful enough to really make functional-style programming practically I can live with that. I find it odd so that as is used in the reverse order compared to current use. The use of as is based on an idea of mine. C# for example has = and

Re: [fpc-devel] Delphi anonymous methods

2013-03-04 Thread Alexander Klenin
On Tue, Mar 5, 2013 at 1:28 AM, Michael Van Canneyt mich...@freepascal.org wrote: Pascal is declarative, Please... no, Pascal is not declarative, and we have establised that fact just about two weeks ago. not functional. Trying to import elements from the second into the first is misguided.

Re: [fpc-devel] Delphi anonymous methods

2013-03-04 Thread Martin
On 04/03/2013 14:49, Sven Barth wrote: Am 04.03.2013 15:42, schrieb Martin: but (4) is powerful enough to really make functional-style programming practically I can live with that. I find it odd so that as is used in the reverse order compared to current use. The use of as is based on

Re: [fpc-devel] Delphi anonymous methods

2013-03-04 Thread Alexander Klenin
On Tue, Mar 5, 2013 at 1:49 AM, Sven Barth pascaldra...@googlemail.com wrote: The use of as is based on an idea of mine. C# for example has = and Oxygene has - which I didn't consider much Pascal like. Also the compiler needs to know the type of the lambda so it can correctly typecheck its code

Re: [fpc-devel] Delphi anonymous methods

2013-03-04 Thread Alexander Klenin
On Tue, Mar 5, 2013 at 2:10 AM, Martin laza...@mfriebe.de wrote: First: Stressing out: I don't like it. But if we must have one, the lambda approach is the best one yet. Reason: At least the type is declared at a pascal-like location. I certainly agree that it is subjective in the sense that

Re: [fpc-devel] Delphi anonymous methods

2013-03-04 Thread Sven Barth
Am 04.03.2013 16:13, schrieb Alexander Klenin: On Tue, Mar 5, 2013 at 1:49 AM, Sven Barth pascaldra...@googlemail.com wrote: The use of as is based on an idea of mine. C# for example has = and Oxygene has - which I didn't consider much Pascal like. Also the compiler needs to know the type of

Re: [fpc-devel] Delphi anonymous methods

2013-03-04 Thread Martin
On 04/03/2013 16:05, Alexander Klenin wrote: Anonymous functions (with good syntax, of course) fall in this category. The world recognized that fact -- rather slowly, to be sure, but remember that whiles and fors also took decades to be accepted as standard constructs. I am not going to ask for

Re: [fpc-devel] Delphi anonymous methods

2013-03-04 Thread Martin
On 04/03/2013 16:05, Alexander Klenin wrote: Both lambda and as keywords are quite debatable, of course. IMHO the existing procedure/function keywords should be kept. But with the requirement of using a defined type Foo( function as TVisitor; Result := x+5 end; ); or Foo( function as

Re: [fpc-devel] Delphi anonymous methods

2013-03-04 Thread Boian Mitov
--- Mitov Software www.mitov.com --- -Original Message- From: Martin Sent: Monday, March 04, 2013 3:35 AM To: FPC developers' list Subject: Re: [fpc-devel] Delphi anonymous methods On 04/03/2013 06:06

Re: [fpc-devel] Delphi anonymous methods

2013-03-04 Thread Boian Mitov
--- Mitov Software www.mitov.com --- -Original Message- From: Michael Van Canneyt Sent: Monday, March 04, 2013 4:23 AM To: FPC developers' list Subject: Re: [fpc-devel] Delphi anonymous

Re: [fpc-devel] Delphi anonymous methods

2013-03-04 Thread Michael Van Canneyt
On Mon, 4 Mar 2013, Boian Mitov wrote: Ye, by writing 20 times more code for the same. What here I can do with 3 lines, otherwise needs declaration of a new class, new interface and new instance of the class. So what I can do here i 15 seconds would take me 1 hour to do traditionally.

Re: [fpc-devel] Delphi anonymous methods

2013-03-04 Thread Michael Van Canneyt
On Mon, 4 Mar 2013, Boian Mitov wrote: Thank you Michael, This is a good advise :-) . I guess I really should stop using Delphi in the future :-) . I am surely not using FPC and staying with Delphi for now, but I appreciate your advise. Having less people use the language is the way to go

  1   2   >