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 impl

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

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 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 : > 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 >> >

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

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 > > i

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 "use

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 rea

[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: 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 i

[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

[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 bein

[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

[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, gi

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 tw

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

2012-08-30 Thread tcoq
constant. When I have some time 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" À: fpc-pascal@lists.freepascal.org Envoyé: Jeudi 30 Août 2012 1

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, o

[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

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

2012-08-30 Thread tcoq
-pascal@lists.freepascal.org Envoyé: 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

[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" : > 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

[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 w

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

2012-08-30 Thread tcoq
+1 - anonymous functions demonstrate a laziness to software design: what you can't name you actually don't design... - Mail original - De: "Ralf A. Quint" À: "FPC-Pascal users discussions" Envoyé: Jeudi 30 Août 2012 09:26:27 Objet: Re: [fpc-pascal] Re: D

[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 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 simp

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 eas

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

2012-08-29 Thread Sven Barth
Am 29.08.2012 22:56 schrieb "Arioch" : > 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 and to some seem

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

[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

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 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 existing us

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

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 becaus

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 pro

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 D

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 compati

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 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" (th

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 plea

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

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 be

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 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 s

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 patch

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 str

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 p

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: bugs.freepascal.o

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

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- compat

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

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 compatibi

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 lang

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 yo

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

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) wh

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

2011-11-06 Thread Florian Klämpfl
Am 06.11.2011 18:24, schrieb 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 some

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

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 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

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 Shishkin 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

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 dmitry boyarintsev
On Sun, Nov 6, 2011 at 8:00 AM, Alexander Shishkin 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 decisions are dire

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

2011-11-06 Thread Bernd
2011/11/6 Florian Klämpfl : > 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 >     targetobject.destinationprocedure(a,b,c)

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/25: 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 : > 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 must admit I am not t

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 : >>> > 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-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 th

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

2011-11-05 Thread Bernd
2011/11/5 Michael Van Canneyt : > 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 >  Targethread.queue(@SomeInner(aobject,d,e,f)); >

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 : targethread.queue( procedure(targetobject:ttargetobject;a:integer;b:someobject;c:string) begin targetobject.destinationprocedure(a,b,c); end; Note how common thi

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 : 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 poin

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/25: 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 i

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; > > sho

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

2011-11-05 Thread Bernd
2011/10/25 Marco van de Voort : > 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 targeth

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

2011-11-05 Thread Bernd
2011/10/25 : >> 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 that you cou

[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 sy

[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 pre

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; N

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 loo

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, 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 tcoq
+1 - Mail Original - De: "Graeme Geldenhuys" À: "FPC-Pascal users discussions" Envoyé: Vendredi 21 Octobre 2011 10h03:27 GMT +01:00 Amsterdam / Berlin / Berne / Rome / Stockholm / Vienne Objet: Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pa

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 catchm

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-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 stri

[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 hap

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

2011-10-21 Thread Graeme Geldenhuys
On 2011-10-20 22:55, Florian Klämpfl wrote: > > The same can be done with fpc (nested if needed) procedure variables and > 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

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

2011-10-20 Thread Juha Manninen
2011/10/21 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 ta

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

2011-10-20 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-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 language

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 systems

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 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 fight, today, wit

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 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 Juha Manninen
2011/10/20 Gregory M. Turner > 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. Juha ___ fpc-pascal maillist - fpc-pascal@list

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

2011-10-20 Thread Juha Manninen
2011/10/20 Florian Klämpfl > 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 called closures in

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 > sho

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 O

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 wh

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

2011-10-19 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 functi

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

2011-10-19 Thread Felipe Monteiro de Carvalho
On Wed, Oct 19, 2011 at 11:28 PM, Andrew Pennebaker 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? -- Felipe Monteiro de Carval

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

2011-10-19 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. P

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

2011-10-19 Thread 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. Cheers, Andrew Pennebaker www.yellosoft.us On Wed,

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

2011-10-19 Thread Michael Fuchs
Am 19.10.2011 20:30, schrieb Florian Klämpfl: > I still don't see why this cannot be done by procedure variables: one > can easily pass a procedure reference to a compare function to any sort > library call. It is maybe easier to write a anonymous function inline than declaring a function and pa

  1   2   >