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] How can I implement "thrice" in Free Pascal?

2011-10-19 Thread Sven Barth
Am 19.10.2011 20:08, schrieb Andrew Pennebaker: Right, I tried just {$mode delphi} and just generic, and when both failed I tried them at the same time. Maybe I'm not using a recent enough version? Free Pascal Compiler version 2.4.4 [2011/05/01] for i386 That's why I said "trunk". Trunk is th

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

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

2011-10-19 Thread Florian Klämpfl
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 f collection) > > This is the prototypical way to run a function over each element in a > collection, returning the resul

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

2011-10-19 Thread Andrew Pennebaker
Practical uses for referencable anonymous functions: (map f collection) This is the prototypical way to run a function over each element in a collection, returning the results. Example: (map (lambda (x) (+ x 1)) '(1 2 3)) -> (2 3 4) (sort compare collection) When dealing with complex data ty

Re: [fpc-pascal] How can I implement "thrice" in Free Pascal?

2011-10-19 Thread Florian Klämpfl
Am 19.10.2011 10:49, schrieb Sven Barth: > Am 19.10.2011 10:27, schrieb Jonas Maebe: >> >> On 19 Oct 2011, at 09:59, Marco van de Voort wrote: >> >>> In our previous episode, Sven Barth said: > This implementation will result in crashes if T is a > reference-counted type. Right...

Re: [fpc-pascal] How can I implement "thrice" in Free Pascal?

2011-10-19 Thread Andrew Pennebaker
Right, I tried just {$mode delphi} and just generic, and when both failed I tried them at the same time. Maybe I'm not using a recent enough version? Free Pascal Compiler version 2.4.4 [2011/05/01] for i386 Cheers, Andrew Pennebaker www.yellosoft.us On Wed, Oct 19, 2011 at 4:34 AM, Sven Barth

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

2011-10-19 Thread Florian Klämpfl
Am 19.10.2011 10:16, schrieb 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 w

[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: http://free-pascal-general.1045716.n5.nabble.com/Delphi-s-anonymous-functions-in-Free-Pa

Re: [fpc-pascal] 3-tier database applications with FPC

2011-10-19 Thread ABorka
On 10/19/2011 07:05, Leonardo M. Ramé wrote: > - Original Message - <...snip...> >>> I created a FastCGI based server that handles JSON requests from a >>> Win32/Linux GUI app, that uses a custom made ORM similar to tiOPF and it >>> works really fast, even on slow-long distance netw

Re: [fpc-pascal] sqldb how to find a record fast with primary key

2011-10-19 Thread Martin Schreiber
On Wednesday 19 October 2011 16.53:00 Felipe Monteiro de Carvalho wrote: > Hello, > > I am using sqldb to connect to a postgres database. Using wiki > instructions, my final object is a TSQLQuery for each table. So, this > basically is a TDataset and to read fields I know that I can use > First(),

[fpc-pascal] sqldb how to find a record fast with primary key

2011-10-19 Thread Felipe Monteiro de Carvalho
Hello, I am using sqldb to connect to a postgres database. Using wiki instructions, my final object is a TSQLQuery for each table. So, this basically is a TDataset and to read fields I know that I can use First(), Next(), EOF() and RecNo But these are rather slow. Many fields in the tables refer

Re: [fpc-pascal] 3-tier database applications with FPC

2011-10-19 Thread Leonardo M . Ramé
- Original Message - > From: "michael.vancann...@wisa.be" > To: Leonardo M. Ramé ; FPC-Pascal users discussions > > Cc: > Sent: Wednesday, October 19, 2011 11:03 AM > Subject: Re: [fpc-pascal] 3-tier database applications with FPC > > > > On Wed, 19 Oct 2011, Leonardo M. Ramé wrote:

Re: [fpc-pascal] 3-tier database applications with FPC

2011-10-19 Thread michael . vancanneyt
On Wed, 19 Oct 2011, Leonardo M. Ramé wrote: From: Graeme Geldenhuys To: FPC-Pascal users discussions Sent: Wednesday, October 19, 2011 8:25 AM Subject: Re: [fpc-pascal] 3-tier database applications with FPC On 2011-10-19 11:36, michael.vancann...@wisa.be wr

Re: [fpc-pascal] 3-tier database applications with FPC

2011-10-19 Thread Leonardo M . Ramé
> >From: Graeme Geldenhuys >To: FPC-Pascal users discussions >Sent: Wednesday, October 19, 2011 8:25 AM >Subject: Re: [fpc-pascal] 3-tier database applications with FPC > >On 2011-10-19 11:36, michael.vancann...@wisa.be wrote: >> >> Out of the box: no. > >OK, than

Re: [fpc-pascal] 3-tier database applications with FPC

2011-10-19 Thread Graeme Geldenhuys
On 2011-10-19 13:34, michael.vancann...@wisa.be wrote: > factor 6 when switching from XML to binary messaging. Not using HTTP but a > self-made TCP/IP protocol gets you another factor. Are both the binary message format and self-made TCP/IP protocol publicly available? Maybe that might be worth im

Re: [fpc-pascal] 3-tier database applications with FPC

2011-10-19 Thread michael . vancanneyt
On Wed, 19 Oct 2011, Graeme Geldenhuys wrote: On 2011-10-19 11:23, Marco van de Voort wrote: - kbmMW http://components4developers.com/ the author was on the Lazarus day in 2010. Strange, nowhere on the kbmMW website do I see any mention of Free Pascal Compiler or Lazarus IDE support.

Re: [fpc-pascal] 3-tier database applications with FPC

2011-10-19 Thread michael . vancanneyt
On Wed, 19 Oct 2011, Graeme Geldenhuys wrote: On 2011-10-19 11:36, michael.vancann...@wisa.be wrote: Out of the box: no. OK, thanks. Do you know if TClientDataset has improved at all? Midas is written in C++, so that's not going to happen. I didn't know that. OTOH the web-developme

Re: [fpc-pascal] 3-tier database applications with FPC

2011-10-19 Thread Graeme Geldenhuys
On 2011-10-19 11:23, Marco van de Voort wrote: > > - kbmMW http://components4developers.com/ > the author was on the Lazarus day in 2010. Strange, nowhere on the kbmMW website do I see any mention of Free Pascal Compiler or Lazarus IDE support. http://www.components4programmers.com/products

Re: [fpc-pascal] 3-tier database applications with FPC

2011-10-19 Thread Graeme Geldenhuys
On 2011-10-19 11:36, michael.vancann...@wisa.be wrote: > > Out of the box: no. OK, thanks. Do you know if TClientDataset has improved at all? > Midas is written in C++, so that's not going to happen. I didn't know that. > OTOH the web-development part has resulted in a ready-to-use packet tr

Re: [fpc-pascal] 3-tier database applications with FPC

2011-10-19 Thread Graeme Geldenhuys
On 2011-10-19 11:23, Marco van de Voort wrote: > > - kbmMW http://components4developers.com/ > the author was on the Lazarus day in 2010. Thanks, I'll take a look. > I take 3-tier above as a general framework for 3-tier, not necessarily a > Datasnap compatible layer. Correct, it doesn't nee

Re: [fpc-pascal] Reopen issue 20500: TSQLParser cant Parse Statements containing "as"

2011-10-19 Thread Reinier Olislagers
On 18-10-2011 7:13, Reinier Olislagers wrote: > On 17-10-2011 20:57, Michael Van Canneyt wrote: >>> Would it make sense to reopen this bug? >> >> ? Eh ? If indeed it is accepted, then yes please. >> >> Quite strange, because I implemented the SQL parser based on the >> official Firebird server docs

Re: [fpc-pascal] 3-tier database applications with FPC

2011-10-19 Thread michael . vancanneyt
On Wed, 19 Oct 2011, Graeme Geldenhuys wrote: Hi, Just over 3 years ago I asked about FPC support for creating 3-tier database applications. The answer was basically: it's not possible (unless you roll your own Midas / Datasnap code). TClientDataset also missed some vital features, and the s

RE: [fpc-pascal] Compiling sources obtained via SVN

2011-10-19 Thread Pierre Free Pascal
> In function `GDBINT$_$TGDBINTERFACE_$__$$_GDB__INIT': > gdbint.pp:(.text+0xfde): undefined reference to > `deprecated_create_breakpoint_hook' > /data2/sources/subversion/fpc/packages/gdbint/units/x86_64-linux/gdbint.o: > In function `GDBINT$_$TGDBINTERFACE_$__$$_GDB_DONE': > gdbint.pp:(.text+0x10

Re: [fpc-pascal] 3-tier database applications with FPC

2011-10-19 Thread Marco van de Voort
In our previous episode, Graeme Geldenhuys said: > Just over 3 years ago I asked about FPC support for creating 3-tier > database applications. The answer was basically: it's not possible > (unless you roll your own Midas / Datasnap code). - kbmMW http://components4developers.com/ the author wa

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

2011-10-19 Thread Alexander Shishkin
19.10.2011 12:16, Sven Barth пишет: E.g. TIntegerFunc = reference to function: Integer; procedure SomeOtherProc(aFunc: TIntegerFunc); ... procedure Foo; var x: Integer; begin x := 42; SomeOtherProc(function: Integer; begin Result := x; end;); end; I haven't tested that, but from the descript

[fpc-pascal] 3-tier database applications with FPC

2011-10-19 Thread Graeme Geldenhuys
Hi, Just over 3 years ago I asked about FPC support for creating 3-tier database applications. The answer was basically: it's not possible (unless you roll your own Midas / Datasnap code). TClientDataset also missed some vital features, and the state of WebServices was also not complete. Here is

Re: [fpc-pascal] Compiling sources obtained via SVN

2011-10-19 Thread Mark Morgan Lloyd
Sven Barth wrote: This seems to be related to building the textmode IDE. If you don't need the textmode IDE you can try the following workaround: Open the "Makefile" in the base directory and search for "IDE=1". Remove the "1" so that it reads "IDE=". Save the file and try again. This should s

Re: [fpc-pascal] Compiling sources obtained via SVN

2011-10-19 Thread Mark Morgan Lloyd
brian wrote: I assume there's an expectation that the sources downloaded from trunk should compile on all platforms? I've just updated to 19505, and attempting to build on Linux Mint 9 64-bit causes a few problems. The first problem I see is that there are actually two makefiles in the fpc

Re: [fpc-pascal] How can I implement "thrice" in Free Pascal?

2011-10-19 Thread Marco van de Voort
In our previous episode, Sven Barth said: > >> > >> Right... I tend to forget about these... what would the correct way to > >> copy an array of ref counted types? E.g. an "array of string"? > > > > copy () ? :-) > > I thought about "copy", too, but how would you implement a generic > "concat" us

Re: [fpc-pascal] How can I implement "thrice" in Free Pascal?

2011-10-19 Thread Sven Barth
Am 19.10.2011 10:27, schrieb Jonas Maebe: On 19 Oct 2011, at 09:59, Marco van de Voort wrote: In our previous episode, Sven Barth said: This implementation will result in crashes if T is a reference-counted type. Right... I tend to forget about these... what would the correct way to copy an

Re: [fpc-pascal] Compiling sources obtained via SVN

2011-10-19 Thread Sven Barth
Am 18.10.2011 12:06, schrieb brian: The first problem I see is that there are actually two makefiles in the fpc directory, Makefile dated 31st Aug 2011 and Makefile.fpc dated 13th Aug 2011. This is normal. The "Makefile.fpc" basically contain the important parts of the makefile (which units ar

Re: [fpc-pascal] How can I implement "thrice" in Free Pascal?

2011-10-19 Thread Marco van de Voort
In our previous episode, Jonas Maebe said: > >> Right... I tend to forget about these... what would the correct way > >> to > >> copy an array of ref counted types? E.g. an "array of string"? > > For-loops. > > > copy () ? :-) > > copy() cannot be used to concatenate two arrays, because it is

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 sho

Re: [fpc-pascal] How can I implement "thrice" in Free Pascal?

2011-10-19 Thread Sven Barth
Am 19.10.2011 10:01, schrieb Andrew Pennebaker: Sven, I added the {$mode delphi} macro and prefaced each type with the "generic" specification. I'm still getting errors. Either add "{$mode delphi}" XOR "generic" E.g. Solution 1: unit Foo; interface type generic TGenArray = array of T; ...

Re: [fpc-pascal] How can I implement "thrice" in Free Pascal?

2011-10-19 Thread Sven Barth
Am 19.10.2011 09:59, schrieb Marco van de Voort: In our previous episode, Sven Barth said: This implementation will result in crashes if T is a reference-counted type. Right... I tend to forget about these... what would the correct way to copy an array of ref counted types? E.g. an "array of s

Re: [fpc-pascal] How can I implement "thrice" in Free Pascal?

2011-10-19 Thread Jonas Maebe
On 19 Oct 2011, at 09:59, Marco van de Voort wrote: In our previous episode, Sven Barth said: This implementation will result in crashes if T is a reference- counted type. Right... I tend to forget about these... what would the correct way to copy an array of ref counted types? E.g. an "a

[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 (gm

Re: [fpc-pascal] Stack corruption setting UnicodeString Char

2011-10-19 Thread Felipe Monteiro de Carvalho
On Wed, Oct 19, 2011 at 10:11 AM, Mattias Gaertner wrote: > I never saw such code for ansistring. Only for shortstring. Indeed, I copied some code from the RTL and it seams that I inadvertedly copied code for shortstring instead of ansistring =o I fixed this in rev 32977 in the Pascal Widestring

Re: [fpc-pascal] Getting Hardware information in Linux

2011-10-19 Thread Žilvinas Ledas
Hello, On 2011-10-18 22:44, Michael Van Canneyt wrote: use DBUS to query HAL. Normally you should get most of the info. I wrote an article on how to do this in FPC. if you want, I can send it to you. Could you send it to me as well? Regards, Žilvinas Ledas __

Re: [fpc-pascal] Stack corruption setting UnicodeString Char

2011-10-19 Thread Mattias Gaertner
Felipe Monteiro de Carvalho hat am 19. Oktober 2011 um 09:13 geschrieben: > Hello, > > Usually when we work with PChars we do things like this to set the > final terminator: > > var >   ansistr: ansistring; > begin >   // Copy the originating string taking into account the specified length > 

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 method

Re: [fpc-pascal] Stack corruption setting UnicodeString Char

2011-10-19 Thread Felipe Monteiro de Carvalho
2011/10/19 Tomas Hajny : > Sorry for a silly question, but why the difference between the two > implementations (i.e. why not addressing the WideStr element directly > without the typecast)? Actually it should be a pointer operation in the ansistring version too, because setting chars in a string

Re: [fpc-pascal] How can I implement "thrice" in Free Pascal?

2011-10-19 Thread Andrew Pennebaker
Sven, I added the {$mode delphi} macro and prefaced each type with the "generic" specification. I'm still getting errors. paycheck.pas: unit Paycheck; {$mode delphi} interface type generic TArray = array of T; generic TFn = function() : T; ... Trace: fpc example.pas Compiling example.pa

Re: [fpc-pascal] How can I implement "thrice" in Free Pascal?

2011-10-19 Thread Marco van de Voort
In our previous episode, Sven Barth said: > > This implementation will result in crashes if T is a reference-counted type. > > Right... I tend to forget about these... what would the correct way to > copy an array of ref counted types? E.g. an "array of string"? copy () ? :-) ___

Re: [fpc-pascal] Stack corruption setting UnicodeString Char

2011-10-19 Thread Tomas Hajny
On Wed, October 19, 2011 09:13, Felipe Monteiro de Carvalho wrote: Hi, > Usually when we work with PChars we do things like this to set the > final terminator: > > var > ansistr: ansistring; > begin > // Copy the originating string taking into account the specified length > SetLength(ansis

Re: [fpc-pascal] Stack corruption setting UnicodeString Char

2011-10-19 Thread Sven Barth
Am 19.10.2011 09:13, schrieb Felipe Monteiro de Carvalho: Hello, Usually when we work with PChars we do things like this to set the final terminator: var ansistr: ansistring; begin // Copy the originating string taking into account the specified length SetLength(ansistr, len+1); Sys

Re: [fpc-pascal] Getting Hardware information in Linux

2011-10-19 Thread Graeme Geldenhuys
On 19/10/2011 00:31, Den Jean wrote: > read the output of lshw or read its source on how to do it yourself. problems with that is that to get most of the information you must run lshw as super-user (root). eg: Serial numbers, product codes, vendor names etc are all missing from the output if you

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

[fpc-pascal] Stack corruption setting UnicodeString Char

2011-10-19 Thread Felipe Monteiro de Carvalho
Hello, Usually when we work with PChars we do things like this to set the final terminator: var ansistr: ansistring; begin // Copy the originating string taking into account the specified length SetLength(ansistr, len+1); System.Move(source^, ansistr[1], len); ansistr[len+1] := #0; Se