Re: [fpc-pascal] Generics problem/question

2010-01-24 Thread Aleksa Todorovic
On Tue, Jan 19, 2010 at 18:35, Aleksa Todorovic wrote: > On Mon, Jan 18, 2010 at 04:07, Aleksa Todorovic wrote: > > One (not very nice) way to have generic list of records is using > macros. I've extracted definition of TFPGList, made it ordinary type, > and did some search/replace, so I get: > >

Re: [fpc-pascal] Generics problem/question

2010-01-19 Thread Aleksa Todorovic
On Mon, Jan 18, 2010 at 04:07, Aleksa Todorovic wrote: > > The proper solution for this problem is not simple. Somehow, you will > have to make operator = (const A, B: TPar) visible inside FGL unit > (because of the way generics are currently implemented), or make > compiler think that TPGList is

Re: [fpc-pascal] Generics problem/question

2010-01-18 Thread Aleksa Todorovic
On Fri, Jan 15, 2010 at 09:00, leledumbo wrote: > > Ah... I can see it now: > > 711  function TFPGList.IndexOf(const Item: T): Integer; > 712  begin > 713    Result := 0; > 714    {$info TODO: fix inlining to work! InternalItems[Result]^} > 715    while (Result < FCount) and (PT(FList)[Result] <>

Re: [fpc-pascal] Generics problem/question

2010-01-15 Thread leledumbo
Ah... I can see it now: 711 function TFPGList.IndexOf(const Item: T): Integer; 712 begin 713Result := 0; 714{$info TODO: fix inlining to work! InternalItems[Result]^} 715while (Result < FCount) and (PT(FList)[Result] <> Item) do 716 Inc(Result); 717if Result = FCount then 7

Re: [fpc-pascal] Generics problem/question

2010-01-14 Thread Honza
Hi all. At Mantis Florian already explained, why it is not possible to provide more information in the error message. Still he meanwhile managed to make it better. I got some time to return to this and now I'm here: 17:11 myn...@tux64:~/fpc/bugreports/20100105$ cat project1.pas program project1;

Re: [fpc-pascal] Generics problem/question

2010-01-08 Thread Honza
Submitted: http://bugs.freepascal.org/view.php?id=15480 ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Generics problem/question

2010-01-07 Thread leledumbo
Sorry, I guess I was wrong. The specialization in my program uses a class instead of a record, the = operator is defined for a record but isn't used at all. I'm not sure where the problem is, only records and static arrays causes it. One solution is to declare a pointer type to your record and sp

Re: [fpc-pascal] Generics problem/question

2010-01-07 Thread leledumbo
> I tried that, but it didn't work Are you sure? Can you compile the attached program (See TicTacToe unit)? I only define = operator and it works. http://old.nabble.com/file/p27056857/TicTacToeAI.zip TicTacToeAI.zip -- View this message in context: http://old.nabble.com/Generics-problem-questi

Re: [fpc-pascal] Generics problem/question

2010-01-06 Thread Marco van de Voort
In our previous episode, leledumbo said: > Inside TFPGList in implementation section, there are some comparisons done > with relational operators (I forgot what they are, just open fgl.pp). You > need to overload those operators for your record type. Surely, the compiler > wouldn't know how to comp

Re: [fpc-pascal] Generics problem/question

2010-01-06 Thread Marco van de Voort
In our previous episode, leledumbo said: > > Inside TFPGList in implementation section, there are some comparisons done > with relational operators (I forgot what they are, just open fgl.pp). You > need to overload those operators for your record type. Surely, the compiler > wouldn't know how to c

Re: [fpc-pascal] Generics problem/question

2010-01-06 Thread leledumbo
The error message needs to be extended for generics type. Inside TFPGList in implementation section, there are some comparisons done with relational operators (I forgot what they are, just open fgl.pp). You need to overload those operators for your record type. Surely, the compiler wouldn't know

[fpc-pascal] Generics problem/question

2010-01-05 Thread Honza
Hi all, I tried to specialize fgl.TFPGList with some record type and got a compiler error. Am I doing something completely wrong (sorry in that case) or is this a bug? (Ubuntu 9.10, 64 bit) 22:35 myn...@tux64:~/fpc/bugreports/20100105$ cat project1.pas program project1; {$mode objfpc}{$H+}