[fpc-pascal] procedure that accept generic types?

2013-09-04 Thread Xiangrong Fang
Hi There, I try to write a procedure with generic parameters, but failed: type generic TArrayT = array of T; procedure ProcessArray(arr: TArrayT); begin end; The compiler said Generics without specialization cannot be used... But if I specialize the parameter then this procedure is

Re: [fpc-pascal] procedure that accept generic types?

2013-09-04 Thread Sven Barth
Am 04.09.2013 08:18, schrieb Xiangrong Fang: Hi There, I try to write a procedure with generic parameters, but failed: type generic TArrayT = array of T; procedure ProcessArray(arr: TArrayT); begin end; The compiler said Generics without specialization cannot be used... But if I

Re: [fpc-pascal] procedure that accept generic types?

2013-09-04 Thread Xiangrong Fang
Thanks. This is sort-of too verbose when use. I have no comments about how to define it, but when use it, can we just use: ProcessArray(someintarray); ? The complier should be able to specialize it implicitly because it knows someintarray is array of integer? alternatively, how about

Re: [fpc-pascal] procedure that accept generic types?

2013-09-04 Thread Sven Barth
Am 04.09.2013 09:13, schrieb Xiangrong Fang: Thanks. This is sort-of too verbose when use. I have no comments about how to define it, but when use it, can we just use: ProcessArray(someintarray); ? No. Generics are specialized with SomeType, so not using it for procedures/functions/methods

Re: [fpc-pascal] procedure that accept generic types?

2013-09-04 Thread Xiangrong Fang
Hi Sven, Not to debate the syntax, but just ask :-) 1) in my second example: proc_ints: specialize ProcessArrayLongInt; it is specialized. Why this is still not consistent ? 2) in delphi mode, specialize is not required anywhere, right? If so, can you write an example of your new proposal in

Re: [fpc-pascal] procedure that accept generic types?

2013-09-04 Thread Sven Barth
Am 04.09.2013 09:41, schrieb Xiangrong Fang: Hi Sven, Not to debate the syntax, but just ask :-) 1) in my second example: proc_ints: specialize ProcessArrayLongInt; it is specialized. Why this is still not consistent ? You declared proc_ints as a variable and specialized a procedure. That

Re: [fpc-pascal] IPC - Persistent Objects - Triplestore

2013-09-04 Thread Mattias Gaertner
On Thu, 29 Aug 2013 12:59:52 +0200 Peter Brooks peter.h.m.bro...@gmail.com wrote: Does anybody know the best support in Pascal for an RDF triplestore? Me too. Is there one written in Pascal? As far as I know: no. I'm interested in Pascal's interprocess communication (IPC), in particular,

Re: [fpc-pascal] PostgreSQL: ERROR: operator does not exists: uuid = text

2013-09-04 Thread Alberto Narduzzi
I am not an expert of PostGres but maybe you are missing the doubled quotes? q.Params.ParamByName('id').AsString := ''71d6776e-1564-11e3-ad65-5349928f15b0''; Cheers, A. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

[fpc-pascal] Runtime error 217 on array of Variant

2013-09-04 Thread Xiangrong Fang
Hi there, I would like to use TVarRec as Variants, after some googling I found this: http://stackoverflow.com/questions/3733640/how-to-convert-between-tvarrec-and-variant However, it generated Runtime error 217. My original code (runs OK) is: 1 program test; 2 {$mode objfpc}{$H+} 3

[fpc-pascal] Re: Runtime error 217 on array of Variant

2013-09-04 Thread Xiangrong Fang
I found the problem myself. You have to add uses Variants to eliminate the problem. So now my questions are: 1) why the Variants unit is required? What does it do? 2) is there any performance penalty using Variant than TVarRec? Thanks! 2013/9/5 Xiangrong Fang xrf...@gmail.com Hi there,

Re: [fpc-pascal] Re: Runtime error 217 on array of Variant

2013-09-04 Thread Sven Barth
Am 05.09.2013 06:21 schrieb Xiangrong Fang xrf...@gmail.com: I found the problem myself. You have to add uses Variants to eliminate the problem. So now my questions are: 1) why the Variants unit is required? What does it do? The Variants unit implements the conversion operators. Normally