Re: [fpc-pascal] Why do string indices start at 1, but array indices start at 0?

2011-10-21 Thread Roberto P.
2011/10/21 Tomas Hajny xhaj...@hajny.biz On 20 Oct 11, at 17:43, Andrew Pennebaker wrote: It's inconsistent and ripe for bugs. Array indices may start at any ordinal value (including e.g. characters, values of enumerated types, etc.), not just 0. Only dynamic arrays always start at 0

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

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

2011-10-21 Thread Graeme Geldenhuys
On 2011-10-20 17:08, Andrew Pennebaker wrote: I'll just wait for v2.6 then. No need to wait, checkout the fixes_2_6 branch, which is currently at version 2.5.1, but will become the v2.6.0 release. This also means you will help test the future 2.6.0 release and catch any possible bugs _before_

Re: [fpc-pascal] Why do string indices start at 1, but array indices start at 0?

2011-10-21 Thread Jonas Maebe
On 21 Oct 2011, at 08:25, Roberto P. wrote: During compilation, by statically checking the indices used to access the string, the compiler could fire a warning (or error?) if a string[0] is found. The compiler already does that (except for shortstrings, where string[0] is valid). Jonas

Re: [fpc-pascal] Why do string indices start at 1, but array indices start at 0?

2011-10-21 Thread Marco van de Voort
In our previous episode, Jonas Maebe said: During compilation, by statically checking the indices used to access the string, the compiler could fire a warning (or error?) if a string[0] is found. The compiler already does that (except for shortstrings, where string[0] is valid). Isn't

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

2011-10-21 Thread Felipe Monteiro de Carvalho
Ping, No sqldb specific answers on this one? I did some googling and also searched for TPrimaryKey or LocalIndex in sqldb without results ... =( thanks, -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

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

2011-10-21 Thread michael . vancanneyt
On Fri, 21 Oct 2011, Felipe Monteiro de Carvalho wrote: Ping, No sqldb specific answers on this one? I did some googling and also searched for TPrimaryKey or LocalIndex in sqldb without results ... =( To my knowledge there is no fast search/locate in sqldb. Maybe we should have a look at

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

2011-10-21 Thread Martin Schreiber
On Friday 21 October 2011 16.30:18 michael.vancann...@wisa.be wrote: On Fri, 21 Oct 2011, Felipe Monteiro de Carvalho wrote: Ping, No sqldb specific answers on this one? I did some googling and also searched for TPrimaryKey or LocalIndex in sqldb without results ... =( To my knowledge

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

2011-10-21 Thread Sven Barth
Am 20.10.2011 17:08, schrieb Andrew Pennebaker: 2.6, eh? Awesome. I'm using the SVN trunk, but it's not working for me for some reason. I'll just wait for v2.6 then. Didn't you just say that you're using 2.4.4? Trunk is currently 2.7.1. Regards, Sven

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

2011-10-21 Thread Felipe Monteiro de Carvalho
On Fri, Oct 21, 2011 at 4:50 PM, Martin Schreiber mse00...@gmail.com wrote: Most code is in lib/common/db/msebufdataset.pas. Lookup buffers are in lib/common/db/mselookupbuffer.pas. Heavy stuff. ;-) How much from the other stuff would I need to compile your DB modules? Any beginner guides to

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

2011-10-21 Thread michael . vancanneyt
On Fri, 21 Oct 2011, Martin Schreiber wrote: On Friday 21 October 2011 16.30:18 michael.vancann...@wisa.be wrote: On Fri, 21 Oct 2011, Felipe Monteiro de Carvalho wrote: Ping, No sqldb specific answers on this one? I did some googling and also searched for TPrimaryKey or LocalIndex in

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

2011-10-21 Thread Martin Schreiber
On Friday 21 October 2011 16.50:32 Felipe Monteiro de Carvalho wrote: On Fri, Oct 21, 2011 at 4:50 PM, Martin Schreiber mse00...@gmail.com wrote: Most code is in lib/common/db/msebufdataset.pas. Lookup buffers are in lib/common/db/mselookupbuffer.pas. Heavy stuff. ;-) How much from the

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

2011-10-21 Thread Ludo Brands
No sqldb specific answers on this one? I did some googling and also searched for TPrimaryKey or LocalIndex in sqldb without results ... =( To my knowledge there is no fast search/locate in sqldb. Maybe we should have a look at Martin Schreibers' implementation. Michael. You can

[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: RE : [fpc-pascal] sqldb how to find a record fast with primary key

2011-10-21 Thread Felipe Monteiro de Carvalho
On Fri, Oct 21, 2011 at 5:22 PM, Ludo Brands ludo.bra...@free.fr wrote: You can use indices and locate with TSQLQuery as follows:  SQLQuery1.AddIndex('idx_no_art','no_art',[]);  SQLQuery1.IndexName:='idx_no_art';  SQLQuery1.Open;  ...  SQLQuery1.Locate('no_art','200295',[]); Thanks, that's

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

2011-10-21 Thread Martin Schreiber
On Friday 21 October 2011 17.41:56 Felipe Monteiro de Carvalho wrote: I get the value of the primary key of the table from the request, so I though that because it is the primary key I would be able to quickly jump to it. But it seams that not? From what I understood the solutions are first

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

2011-10-21 Thread Ludo Brands
Can't you do the lookup in the DB server by a SQL join for example? Or, if you need do some processing in between, use 2 queries and build the where clause for the 2nd from the results of the 1st. If you don't need the full table, don't use select *. Ludo

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

2011-10-21 Thread Michael Van Canneyt
On Fri, 21 Oct 2011, Felipe Monteiro de Carvalho wrote: On Fri, Oct 21, 2011 at 5:22 PM, Ludo Brands ludo.bra...@free.fr wrote: You can use indices and locate with TSQLQuery as follows:  SQLQuery1.AddIndex('idx_no_art','no_art',[]);  SQLQuery1.IndexName:='idx_no_art';  SQLQuery1.Open;  ...  

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

2011-10-21 Thread Alexander Shishkin
18.10.2011 0:53, Andrew Pennebaker пишет: Does Free Pascal have anonymous functions that you can pass around, e.g. to a sort(compare : function, arr : array) function? anonymous functions = closures = lambdas are part of functional paradigm. object pascal itself is not functional language.

[fpc-pascal] How are Assigned, Free, Nil and Destroy related?

2011-10-21 Thread Frank Church
This is one question I have wanted to ask for a long time. How are Assigned, Free, Nil and Destroy related, and when is one or another appropriate? What other procedure have I missed? There are so many articles and mailing list threads on this issue that I don't think asking it makes me sound

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] Delphi's anonymous functions in Free Pascal

2011-10-21 Thread Gregory M. Turner
- Original Message - 18.10.2011 0:53, Andrew Pennebaker пишет: Does Free Pascal have anonymous functions that you can pass around, e.g. to a sort(compare : function, arr : array) function? anonymous functions = closures = lambdas are part of functional paradigm. object pascal

[fpc-pascal] Re: How are Assigned, Free, Nil and Destroy related?

2011-10-21 Thread Frank Church
On 21 October 2011 18:19, Frank Church vfcli...@gmail.com wrote: This is one question I have wanted to ask for a long time. How are Assigned, Free, Nil and Destroy related, and when is one or another appropriate? What other procedure have I missed? There are so many articles and mailing