Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2012-08-30 Thread Sven Barth
Am 29.08.2012 22:56 schrieb Arioch arioch...@gmail.com: Surely 1949-styled Pascal can not make all that features 1st citizens. The question is how much and in what style of compromise can be implemented. Generics were also heresy for original Pascal. But they are implemented, some in Delphi

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2012-08-30 Thread michael . vancanneyt
On Wed, 29 Aug 2012, Arioch wrote: Florian Klämpfl wrote This is the prototypical way to run a function over each element in a collection, returning the results. (map (lambda (x) (+ x 1)) '(1 2 3)) - (2 3 4) I still don't see why this cannot be done by procedure variables: one can

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2012-08-30 Thread Ralf A. Quint
At 12:09 AM 8/30/2012, michael.vancann...@wisa.be wrote: I don't think anonymous functions should be added to the compiler at all. They are IMHO a negation of what pascal stands for. If your programming style is so strange that you need lamba functions or anonymous functions, then Pascal is

[fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2012-08-30 Thread Arioch
I'm curious: where do you get this 1948 date from? I'm not even sure that assemblers (as we know them) existed in 1949... Mark Morgan Lloyd Damn! you're definitely right. At vwery very least Pascal could not be before Algol-68, which could not be before... ahem. But now I wonder myself

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2012-08-30 Thread tcoq
-pascal] Re: Delphi's anonymous functions in Free Pascal At 12:09 AM 8/30/2012, michael.vancann...@wisa.be wrote: I don't think anonymous functions should be added to the compiler at all. They are IMHO a negation of what pascal stands for. If your programming style is so strange that you need lamba

[fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2012-08-30 Thread Arioch
Ralf A. Quint wrote At 12:09 AM 8/30/2012, michael.vancanneyt@ wrote: They are IMHO a negation of what pascal stands for. If your programming +1 Well, the same should be told about everything modern pascal is. Open and dynamic arrays, pointer math, objects, generics, even units. It was

[fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2012-08-30 Thread Arioch
Sven Barth-2 wrote Am 29.08.2012 22:56 schrieb Arioch lt;AriochThe@gt;: I don't know whether you tested recent versions of FPC, but since 2.6.0 the support for Delphi compatible generics improved, though generic functions/methods and constraints are still missing. Thanks. No, i just

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2012-08-30 Thread tcoq
: Jeudi 30 Août 2012 10:04:08 Objet: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal Ralf A. Quint wrote At 12:09 AM 8/30/2012, michael.vancanneyt@ wrote: They are IMHO a negation of what pascal stands for. If your programming +1 Well, the same should be told about everything modern

[fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2012-08-30 Thread Arioch
tcoq wrote a laziness to software design: what you can't name you actually don't design... Guess you meant don't want to instead of can't And You mean all the non-named arrays, don't you. var x: array[0..10] of integer; is not only violating Pascal Report, but also is twice lazy. since

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2012-08-30 Thread michael . vancanneyt
On Thu, 30 Aug 2012, Arioch wrote: Ralf A. Quint wrote At 12:09 AM 8/30/2012, michael.vancanneyt@ wrote: They are IMHO a negation of what pascal stands for. If your programming +1 Well, the same should be told about everything modern pascal is. Open and dynamic arrays, pointer math,

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2012-08-30 Thread tcoq
for refactoring, i try removing some of the more offending smells... What's nice about Pascal is that we all smell them easily... ;-) Thierry - Mail original - De: Arioch arioch...@gmail.com À: fpc-pascal@lists.freepascal.org Envoyé: Jeudi 30 Août 2012 10:18:31 Objet: [fpc-pascal] Re: Delphi's

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2012-08-30 Thread Mark Morgan Lloyd
Arioch wrote: tcoq wrote a laziness to software design: what you can't name you actually don't design... Guess you meant don't want to instead of can't And You mean all the non-named arrays, don't you. var x: array[0..10] of integer; is not only violating Pascal Report, but also is twice

[fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2012-08-30 Thread Arioch
If the new features conform to the readability That heavily depends upon which patterns are known to reader. We all are patterns recognizers. And today world is very different. In my example sketch, the calling like Data.Filter( _.TotalSale 20 ) is concise and easy to understand. Okay, given

[fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2012-08-30 Thread Lukasz Sokol
On 30/08/2012 09:04, Arioch wrote: Ralf A. Quint wrote At 12:09 AM 8/30/2012, michael.vancanneyt@ wrote: They are IMHO a negation of what pascal stands for. If your programming +1 Well, the same should be told about everything modern pascal is. Open and dynamic arrays, pointer

[fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2012-08-30 Thread Arioch
var x: array[0..10] of integer; also is twice lazy. type SomeEnumSemanticName = 0..10; SomeEnumMapSemanticName = array[SomeEnumSemanticName] of integer; var x: SomeEnumMapSemanticName; Except that not defining a distinct type emphasises that the array is only being declared

[fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2012-08-30 Thread Arioch
Pascal never was a toy language. It always have too much required naming-and-declarations/boilerplate/obstacles/you-name-it Basic, Logo - let them be. But not the Pascal. It was educational language but it was damn serious educational language. However i believe that your but pointer math is

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2012-08-30 Thread michael . vancanneyt
On Thu, 30 Aug 2012, Arioch wrote: If the new features conform to the readability [snip] But afterall i am quitting on that. Since FPC are lacking closures i am sure here are mostly people who personally dislike them. I wanted to document why closures are good and do matter. Hopefully

[fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2012-08-30 Thread Arioch
Regarding this: I wish to stress that my views on lambdas or closures are my own; For what i understand, those are different things. Lambdas are runtime code generators and are out of question for natively compiled language. Closures are not. Maybe that is nitpicking today, since the names seems

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2012-08-30 Thread michael . vancanneyt
On Thu, 30 Aug 2012, Arioch wrote: From personal experience, when i first time saw how pascalish is closures implementation in Delphi i just admired the ease in which that concept was fused into the language of very different style built upon very different ideas. It was so elegant when

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2012-08-30 Thread tcoq
Thank you but I am a professional trainer for C++, Java, Ada and other languages including Lisp. I am used to those languages. I consistently see young professionals stumble upon those constructs they are used to. Furthermore, all the professional users of the developed software are not used

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2012-08-30 Thread Marco van de Voort
In our previous episode, michael.vancann...@wisa.be said: From personal experience, when i first time saw how pascalish is closures implementation in Delphi i just admired the ease in which that concept was fused into the language of very different style built upon very different ideas. It

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2012-08-30 Thread Ralf A. Quint
At 01:18 AM 8/30/2012, Arioch wrote: tcoq wrote a laziness to software design: what you can't name you actually don't design... Guess you meant don't want to instead of can't And You mean all the non-named arrays, don't you. var x: array[0..10] of integer; is not only violating Pascal

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2012-08-30 Thread Jorge Aldo G. de F. Junior
I still fail to see where annonymous functions could succeed where functional types (part of pascal since last millenia) wouldnt... 2012/8/30 Ralf A. Quint free...@gmx.net: At 01:18 AM 8/30/2012, Arioch wrote: tcoq wrote a laziness to software design: what you can't name you actually

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2012-08-30 Thread Sven Barth
On 30.08.2012 11:03, Arioch wrote: But afterall i am quitting on that. Since FPC are lacking closures i am sure here are mostly people who personally dislike them. I wanted to document why closures are good and do matter. Hopefully i did it to the extent i was able to. Surely i would not be able

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2012-08-30 Thread Jürgen Hestermann
Am 2012-08-30 18:29, schrieb Ralf A. Quint: Pascal has evolved since Wirth's original design back in the 70s This is true. But there are two aspects of the Pascal extensions of the last years (decades) that contradict with what I would call the spirit of Pascal: 1.) Many extensions add to the

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2012-08-30 Thread Marco van de Voort
In our previous episode, Sven Barth said: The closures (or anonymous functions as they are called in Delphi) are missing, because none of the developers has them on the important slots of the todo lists. So as long as nobody comes and implements them then they are not going to be

[fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2012-08-29 Thread Arioch
Florian Klämpfl wrote This is the prototypical way to run a function over each element in a collection, returning the results. (map (lambda (x) (+ x 1)) '(1 2 3)) - (2 3 4) I still don't see why this cannot be done by procedure variables: one can easily pass a procedure reference to a

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2012-08-29 Thread Mark Morgan Lloyd
Arioch wrote: Here we are at dilemma. Pascal was devised in 1949 to look like Classic monumental style building, or at least some manufacturing plant style building made of bricks industrial way. Functional style is like more like elegant houses made of paper and thin plywood, something mayeb

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-08 Thread Graeme Geldenhuys
On 8 November 2011 09:23, Florian Klaempfl wrote: Let me answer: Writing an (L)GPL'ed pascal (*) compiler being self hosting. From the man himself. OK good, so now we all know the goal is not one of delphi compatible (that is rather limited only as a side effect - nice to have), so please

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-08 Thread Tomas Hajny
On Tue, November 8, 2011 09:01, Graeme Geldenhuys wrote: On 8 November 2011 09:23, Florian Klaempfl wrote: Let me answer: Writing an (L)GPL'ed pascal (*) compiler being self hosting. From the man himself. OK good, so now we all know the goal is not one of delphi compatible (that is rather

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-08 Thread Graeme Geldenhuys
2011/11/8 Tomas Hajny : Examples? I can list them all, but I'm not going to waist my time on them again. Search the mailing list or Mantis. But to humour you, here is just one of many examples: THelpEvent in the RTL. I proposed a patch to change it to be more in line with FPC's goals [being a

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-08 Thread Martin Schreiber
On Tuesday 08 November 2011 09.01:03 Graeme Geldenhuys wrote: On 8 November 2011 09:23, Florian Klaempfl wrote: Let me answer: Writing an (L)GPL'ed pascal (*) compiler being self hosting. From the man himself. OK good, so now we all know the goal is not one of delphi compatible (that

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-08 Thread Marco van de Voort
In our previous episode, Martin Schreiber said: nice to have), so please all core developers, stop using that as an excuse to stop other FPC innovation. Over the years I have heard many features being declined because they will not be delphi compatible. I fear the opposite: all Delphi

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-08 Thread Tomas Hajny
On Tue, November 8, 2011 09:37, Graeme Geldenhuys wrote: 2011/11/8 Tomas Hajny : Examples? I can list them all, but I'm not going to waist my time on them again. Search the mailing list or Mantis. But to humour you, here is just one of many examples: THelpEvent in the RTL. I proposed a

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-08 Thread Martin Schreiber
On Tuesday 08 November 2011 10.56:21 Marco van de Voort wrote: In our previous episode, Martin Schreiber said: nice to have), so please all core developers, stop using that as an excuse to stop other FPC innovation. Over the years I have heard many features being declined because they

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-08 Thread Florian Klaempfl
Am 08.11.2011 09:37, schrieb Graeme Geldenhuys: 2011/11/8 Tomas Hajny : Examples? I can list them all, but I'm not going to waist my time on them again. Search the mailing list or Mantis. But to humour you, here is just one of many examples: THelpEvent in the RTL. I proposed a patch to

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-08 Thread Graeme Geldenhuys
On 8 November 2011 12:43, Florian Klaempfl florian@f... wrote: So you wanted to break existing stuff other people probably used? It is indeed one of FPC's policy to avoid breakage of exisiting code. Break what existing code? I searched all of FPC, Lazarus, Lazarus CCR and MSEgui - there was no

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-07 Thread Martin Schreiber
On Sunday 06 November 2011 18.24:16 Jürgen Hestermann wrote: Also, implementing all existing language constructs from all other languages into Pascal makes it a monster that no one can handle anymore. Supporting Delphi code sounds good in the first place but in the end it bloats the language

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-07 Thread Jonas Maebe
On 07 Nov 2011, at 08:10, Martin Schreiber wrote: I don't understand why FPC should become a 100% Delphi clone instead the best general software development environment ever for the only purpose that Delphi users have a free cross platform alternative without to care about FPC

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-07 Thread Martin Schreiber
On Monday 07 November 2011 10.55:41 Jonas Maebe wrote: On 07 Nov 2011, at 08:10, Martin Schreiber wrote: I don't understand why FPC should become a 100% Delphi clone instead the best general software development environment ever for the only purpose that Delphi users have a free cross

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-07 Thread Jonas Maebe
On 07 Nov 2011, at 11:28, Martin Schreiber wrote: On Monday 07 November 2011 10.55:41 Jonas Maebe wrote: On 07 Nov 2011, at 08:10, Martin Schreiber wrote: One reason is to make it easy for FPC users to reuse existing Delphi code that is out there without having to rewrite it in an FPC-

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-07 Thread Luiz Americo Pereira Camara
On 7/11/2011 07:28, Martin Schreiber wrote: One reason is to make it easy for FPC users to reuse existing Delphi code that is out there without having to rewrite it in an FPC- compatible way. Is there a big demand? Examples? I speak only for myself. This is a component that i'd like

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-07 Thread Martin Schreiber
On Monday 07 November 2011 17.02:59 Luiz Americo Pereira Camara wrote: Is there a big demand? Examples? I speak only for myself. This is a component that i'd like to see compiled with fpc http://code.google.com/p/emballo/ The problems - generic support:

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-07 Thread Jürgen Hestermann
Jonas Maebe schrieb: That's exactly what he said: you are free to create a fork (= take the FPC source code and do whatever you want with it), and then the currently active FPC developers are also free to take whichever of your patches they consider useful. What's not possible is that other

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-07 Thread Marco van de Voort
In our previous episode, Martin Schreiber said: So probably there are at least two different expectations into FPC which can't be fulfilled both: best general purpose software development environment ever and 100% current Delphi compatibility. That current is added by you. FPC strives to

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-07 Thread Jonas Maebe
On 07 Nov 2011, at 18:45, Jürgen Hestermann wrote: Jonas Maebe schrieb: That's exactly what he said: you are free to create a fork (= take the FPC source code and do whatever you want with it), and then the currently active FPC developers are also free to take whichever of your patches

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-07 Thread Jürgen Hestermann
Jonas Maebe schrieb: That's exactly what he said: you are free to create a fork This argument is pulled out each time someone suggest things that the main developers don't like. The reason that this argument is always used is simply because that is simply how it is. I know that. But still:

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-07 Thread Graeme Geldenhuys
On 7 November 2011 20:41, Marco van de Voort wrote: That current is added by you. FPC strives to do that of course, but never had the illusion it was near enough to claim something like that. Not now, and not in the past. So what exactly is the goals of FPC then? And please don't tell me

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-07 Thread Florian Klaempfl
Am 08.11.2011 07:20, schrieb Jürgen Hestermann: Jonas Maebe schrieb: That's exactly what he said: you are free to create a fork This argument is pulled out each time someone suggest things that the main developers don't like. The reason that this argument is always used is simply because that

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-07 Thread Florian Klaempfl
Am 08.11.2011 07:35, schrieb Graeme Geldenhuys: On 7 November 2011 20:41, Marco van de Voort wrote: That current is added by you. FPC strives to do that of course, but never had the illusion it was near enough to claim something like that. Not now, and not in the past. So what exactly is

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-06 Thread Florian Klämpfl
Am 05.11.2011 22:58, schrieb Alexander Shishkin: 06.11.2011 1:46, Michael Van Canneyt пишет: On Sat, 5 Nov 2011, Bernd wrote: 2011/10/25 michael.vancann...@wisa.be: targethread.queue( procedure(targetobject:ttargetobject;a:integer;b:someobject;c:string) begin

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-06 Thread Bernd
2011/11/6 Michael Van Canneyt mich...@freepascal.org: I am not against closure functionality, although I highly doubt it is *that* useful as some people make it out to be. Even so, I use it in my Javascript programming. I'm also not entirely sure about the necessity of closures in OP, but I

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-06 Thread Alexander Shishkin
06.11.2011 15:53, Florian Klämpfl пишет: Am 05.11.2011 22:58, schrieb Alexander Shishkin: 06.11.2011 1:46, Michael Van Canneyt пишет: On Sat, 5 Nov 2011, Bernd wrote: 2011/10/25michael.vancann...@wisa.be: targethread.queue(

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-06 Thread Bernd
2011/11/6 Florian Klämpfl flor...@freepascal.org: It would be probably more clear to write and this more pascalish: Procedure SomeOuter; Var  d,e,f : SomeType;  Lambda Procedure SomeInner(targetobject:ttargetobject;a:integer;b:someobject;c:string)  begin    

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-06 Thread dmitry boyarintsev
On Sun, Nov 6, 2011 at 8:00 AM, Alexander Shishkin alexv...@mail.ru wrote: OK, agreed, this is more readable than Delphi syntax. But ... 1) If we implement lamdas is FPC we will have to support Delphi syntax. Hi-jacking, the thread, and again should FPC chase Delphi forever? Their technical

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-06 Thread Jonas Maebe
On 06 Nov 2011, at 15:13, dmitry boyarintsev wrote: Hi-jacking, the thread, and again should FPC chase Delphi forever? If we want to offer compatibility with source code written for Delphi, which does happen to be one of FPC's project goals, then yes, we do have to do that to some extent.

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-06 Thread Alexander Shishkin
06.11.2011 18:13, dmitry boyarintsev пишет: On Sun, Nov 6, 2011 at 8:00 AM, Alexander Shishkinalexv...@mail.ru wrote: OK, agreed, this is more readable than Delphi syntax. But ... 1) If we implement lamdas is FPC we will have to support Delphi syntax. Hi-jacking, the thread, and again should

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-06 Thread Florian Klämpfl
Am 06.11.2011 15:13, schrieb dmitry boyarintsev: On Sun, Nov 6, 2011 at 8:00 AM, Alexander Shishkin alexv...@mail.ru wrote: OK, agreed, this is more readable than Delphi syntax. But ... 1) If we implement lamdas is FPC we will have to support Delphi syntax. Hi-jacking, the thread, and again

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-06 Thread Jürgen Hestermann
Florian Klämpfl schrieb: Am 06.11.2011 15:13, schrieb dmitry boyarintsev: Hi-jacking, the thread, and again should FPC chase Delphi forever? You mix here result and goal. If FPC supports new Delphi constructs depends on the fact if somebody provides a patch. No more, no less. I have the same

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-06 Thread Jürgen Hestermann
Florian Klämpfl schrieb: I have the same feeling as Dmitry: There must be a time when FPC does not run after Delphi. Why not now? Feel free to start a fork and we will see what will make it into trunk. Sorry, but I don't know what you are talking about. Isn't it you (and a few others) who

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-06 Thread Jonas Maebe
On 06 Nov 2011, at 19:21, Jürgen Hestermann wrote: Florian Klämpfl schrieb: I have the same feeling as Dmitry: There must be a time when FPC does not run after Delphi. Why not now? Feel free to start a fork and we will see what will make it into trunk. Sorry, but I don't know what you

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-06 Thread Florian Klämpfl
Am 06.11.2011 19:21, schrieb Jürgen Hestermann: Florian Klämpfl schrieb: I have the same feeling as Dmitry: There must be a time when FPC does not run after Delphi. Why not now? Feel free to start a fork and we will see what will make it into trunk. Sorry, but I don't know what you are

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-05 Thread Bernd
2011/10/25 michael.vancann...@wisa.be: targethread.queue(  procedure(targetobject:ttargetobject;a:integer;b:someobject;c:string)             begin               targetobject.destinationprocedure(a,b,c);             end; Note how common this looks compared to the original. One point is

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-05 Thread Bernd
2011/10/25 Marco van de Voort mar...@stack.nl: Equivalent solution with anon functions: targethread.queue(   procedure(targetobject:ttargetobject;a:integer;b:someobject;c:string)              begin                targetobject.destinationprocedure(a,b,c);              end; shouldn't this be

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-05 Thread Marco van de Voort
In our previous episode, Bernd said: Equivalent solution with anon functions: targethread.queue( ? procedure(targetobject:ttargetobject;a:integer;b:someobject;c:string) ? ? ? ? ? ? ?begin ? ? ? ? ? ? ? ?targetobject.destinationprocedure(a,b,c); ? ? ? ? ? ? ?end; shouldn't this be

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-05 Thread Alexander Shishkin
05.11.2011 22:42, Bernd пишет: 2011/10/25michael.vancann...@wisa.be: targethread.queue( procedure(targetobject:ttargetobject;a:integer;b:someobject;c:string) begin targetobject.destinationprocedure(a,b,c); end; Note how common this looks compared to

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-05 Thread Michael Van Canneyt
On Sat, 5 Nov 2011, Bernd wrote: 2011/10/25 michael.vancann...@wisa.be: targethread.queue(  procedure(targetobject:ttargetobject;a:integer;b:someobject;c:string)             begin               targetobject.destinationprocedure(a,b,c);             end; Note how common this looks compared

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-05 Thread Alexander Shishkin
06.11.2011 1:46, Michael Van Canneyt пишет: On Sat, 5 Nov 2011, Bernd wrote: 2011/10/25 michael.vancann...@wisa.be: targethread.queue( procedure(targetobject:ttargetobject;a:integer;b:someobject;c:string) begin targetobject.destinationprocedure(a,b,c);

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-05 Thread Bernd
2011/11/5 Michael Van Canneyt mich...@freepascal.org: Procedure SomeOuter; Var  d,e,f : SomeType;  Procedure SomeInner(targetobject:ttargetobject;a:integer;b:someobject;c:string)   begin      targetobject.destinationprocedure(a,b,c);   end; begin  

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-05 Thread Michael Van Canneyt
On Sat, 5 Nov 2011, Bernd wrote: A closure has enclosed variables from the surrounding scope where it was created, hence the name 'closure'. You cannot do this with a procedure variable alone, you need an object on the heap to contain the enclosed variables. The Delphi compiler will behind

[fpc-pascal] Re: Delphi's anonymous functions in Free Pascal OT]

2011-10-26 Thread Lukasz Sokol
On 25/10/2011 12:52, Marco van de Voort wrote: One can debate the syntax. I won't, since even while I have similar reservations, that will lead to the usual Delphi sucks debate, possible implementation of an-orphaned-at-birth FPC specific syntax, and in the end the Delphi syntax always

[fpc-pascal] Re: Delphi's anonymous functions in Free Pascal [OT]

2011-10-26 Thread Lukasz Sokol
On 26/10/2011 09:44, Lukasz Sokol wrote: On 25/10/2011 12:52, Marco van de Voort wrote: One can debate the syntax. I won't, since even while I have similar reservations, that will lead to the usual Delphi sucks debate, possible implementation of an-orphaned-at-birth FPC specific syntax, and

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-10-25 Thread tcoq
+1 - Mail Original - De: Graeme Geldenhuys graemeg.li...@gmail.com À: FPC-Pascal users discussions fpc-pascal@lists.freepascal.org Envoyé: Vendredi 21 Octobre 2011 10h03:27 GMT +01:00 Amsterdam / Berlin / Berne / Rome / Stockholm / Vienne Objet: Re: [fpc-pascal] Re: Delphi's anonymous

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-10-25 Thread Marco van de Voort
In our previous episode, t...@free.fr said: it will be more readable (imo)? The example still does not take This seldom happens, but here I fully agree with Florian. ;-) Every example of anonymous methods I have seen so far, can easily be done with OP's procedure variables too. Maybe

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-10-25 Thread michael . vancanneyt
On Tue, 25 Oct 2011, Marco van de Voort wrote: In our previous episode, t...@free.fr said: it will be more readable (imo)? The example still does not take This seldom happens, but here I fully agree with Florian. ;-) Every example of anonymous methods I have seen so far, can easily be done

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-10-25 Thread Marco van de Voort
In our previous episode, michael.vancann...@wisa.be said: targethread.queue( procedure(targetobject:ttargetobject;a:integer;b:someobject;c:string) begin targetobject.destinationprocedure(a,b,c); end; Note how common this looks compared to

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-10-25 Thread michael . vancanneyt
On Tue, 25 Oct 2011, Marco van de Voort wrote: In our previous episode, michael.vancann...@wisa.be said: targethread.queue( procedure(targetobject:ttargetobject;a:integer;b:someobject;c:string) begin targetobject.destinationprocedure(a,b,c); end;

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-10-24 Thread waldo kitty
On 10/21/2011 01:25, Jürgen Hestermann wrote: Florian Klämpfl schrieb: If anybody does not see why increasing complexity without a good reason should be avoided, I recommend: I agree wholeheartly. In the past Pascal was a simple still powerfull language but meanwhile it has become a

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-10-21 Thread Florian Klaempfl
Am 21.10.2011 03:49, schrieb Andrew Pennebaker: Lisp used for nuclear fail-safe systems I doubt languages without /map/ are up to the job. Great, why don't you continue to use lisp then? If pascal does not offers the language concepts you are used to, pascal is the wrong language for you.

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-10-21 Thread Juha Manninen
2011/10/21 Jürgen Hestermann juergen.hesterm...@gmx.de Florian Klämpfl schrieb: If anybody does not see why increasing complexity without a good reason should be avoided, I recommend: I agree wholeheartly. In the past Pascal was a simple still powerfull language but meanwhile it has

[fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-10-21 Thread leledumbo
Maybe anonymous methods were introduced in other languages because they didn't have something like OP's procedure variables IMO, it's because they're lazy to declare things before they use it. Often, an anonymous function which first used just once eventually used more than once. When that

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-10-21 Thread Jürgen Hestermann
Juha Manninen schrieb: Please look at some old Pascal code from 80's. Lots of shortstring manipulation with pointers. Very much comparable to C, and as prone to errors as C. Yes, new string types were needed. But why not doing it right in one step? Instead we now have lots of different

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-10-21 Thread Marco van de Voort
The link below describes two uses for anonymous methods. http://stackoverflow.com/questions/7818759/delphi-anonymus-methods-pro-and-cons-good-practices-when-using-closuresanony/7821882#comment9576663_7821882 I don't entirely subscribe to the (1) one, it seems to be mostly a shorthand argument.

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-10-20 Thread Sven Barth
Am 19.10.2011 23:28, schrieb Andrew Pennebaker: From what I gather, procedure variables can indeed be referenced and passed around, etc. However, procedures do not return anything, so it's hard to chain them. In functional languages, it's handy to do several nested map(map(map f ... calls.

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-10-20 Thread Felipe Monteiro de Carvalho
On Wed, Oct 19, 2011 at 11:28 PM, Andrew Pennebaker andrew.penneba...@gmail.com wrote: However, procedures do not return anything, so it's hard to chain them. In functional languages, it's handy to do several nested map(map(map f ... calls. So just make a function instead of a procedure? --

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-10-20 Thread Florian Klaempfl
Am 19.10.2011 23:28, schrieb Andrew Pennebaker: From what I gather, procedure variables can indeed be referenced and passed around, etc. However, procedures do not return anything, so it's hard to chain them. They are called procedure variables but can also contain functions. In functional

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-10-20 Thread Gregory M. Turner
- Original Message - Am 19.10.2011 20:23, schrieb Andrew Pennebaker: Practical uses for referencable anonymous functions: For such applications one uses procedure variables in pascal. (map (lambda (x) (+ x 1)) '(1 2 3)) - (2 3 4) [snip!] I still don't see why this cannot

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-10-20 Thread Florian Klämpfl
Am 20.10.2011 21:09, schrieb Gregory M. Turner: Interesting discussion -- at least for me, I didn't know Delphi had this feature. In case anyone really doesn't see the point, consider that this thing: http://www.youtube.com/watch?v=cYw2ewoO6c4 has all the capabilities of Object

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-10-20 Thread Gregory M. Turner
- Original Message - Am 20.10.2011 21:09, schrieb Gregory M. Turner: In case anyone really doesn't see the point, consider that this thing: http://www.youtube.com/watch?v=cYw2ewoO6c4 If anybody does not see why increasing complexity without a good reason should be

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-10-20 Thread Juha Manninen
2011/10/20 Florian Klämpfl flor...@freepascal.org If anybody does not see why increasing complexity without a good reason should be avoided, I recommend: http://www.youtube.com/watch?v=kYUrqdUyEpI :-) There is lots of confusion about anonymous functions. The name is misleading, they are

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-10-20 Thread Florian Klämpfl
Am 20.10.2011 22:31, schrieb Juha Manninen: They have some very important uses, like making multithreading easier. I copy text from Delphi help page again here because it looks so cool: The same can be done with fpc (nested if needed) procedure variables and it will be more readable (imo)?

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-10-20 Thread waldo kitty
On 10/20/2011 15:17, Florian Klämpfl wrote: Am 20.10.2011 21:09, schrieb Gregory M. Turner: Interesting discussion -- at least for me, I didn't know Delphi had this feature. In case anyone really doesn't see the point, consider that this thing: http://www.youtube.com/watch?v=cYw2ewoO6c4

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-10-20 Thread waldo kitty
On 10/20/2011 16:35, Juha Manninen wrote: 2011/10/20 Gregory M. Turner g...@malth.us mailto:g...@malth.us Good point. I guess nothing's O(free lunch). Yes, the downside here is that the concept is very different from any syntax in OP. It will be difficult to learn properly. i still

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-10-20 Thread Andrew Pennebaker
If anybody does not see why increasing complexity without a good reason should be avoided, I recommend: http://www.youtube.com/watch?v=kYUrqdUyEpI Lisp used for nuclear fail-safe

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-10-20 Thread Jürgen Hestermann
Florian Klämpfl schrieb: If anybody does not see why increasing complexity without a good reason should be avoided, I recommend: I agree wholeheartly. In the past Pascal was a simple still powerfull language but meanwhile it has become a catchment tank for all features of all other

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-10-19 Thread Michael Fuchs
Am 18.10.2011 21:42, schrieb Sven Barth: For anonymous functions you can take a look at Embarcadero's Delphi help here: http://docwiki.embarcadero.com/RADStudio/en/Anonymous_Methods_in_Delphi The Embarcadero style of anonymous functions does not satify me. myFunc := function(x, y: Integer):

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-10-19 Thread Sven Barth
Am 19.10.2011 09:31, schrieb Michael Fuchs: I would prefer a style like myfunc := @function(x, y: Integer): Integer Result := x + y; And how would you create more complex functions? In Pascal code blocks are started with begin and ended with end. I don't see a reason why anonymous methods

[fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-10-19 Thread Lukasz Sokol
Hi Andrew, first of all my /first/ name is Lukasz. Would you /like/ me to use your surname to refer to yourself ? Second you seem to be sending the same message twice in one post (once as plain text the other as HTML) and quoted/printable encoding to make matters even worse. Please teach your

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-10-19 Thread Michael Fuchs
Am 19.10.2011 10:16, schrieb Sven Barth: I would prefer a style like myfunc := @function(x, y: Integer): Integer Result := x + y; And how would you create more complex functions? In Pascal code blocks are started with begin and ended with end. I don't see a reason why anonymous methods should

[fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-10-19 Thread leledumbo
Hmm... I'm not really sure though, but I guess you could make use of array of const feature. See the documentation here: http://www.freepascal.org/docs-html/ref/refsu60.html -- View this message in context:

  1   2   >