Re: [fpc-devel] Errors using generics - what is wrong?
Žilvinas Ledas wrote: Thanks, it works with named type. Is using not named specializations is some kind of not implemented yet part? :) No it's a design choice to more easily reuse separate (but equal) specializations. Micha ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Errors using generics - what is wrong?
On Wed, October 7, 2009 11:27, Micha Nelissen wrote: Žilvinas Ledas wrote: Thanks, it works with named type. Is using not named specializations is some kind of not implemented yet part? :) No it's a design choice to more easily reuse separate (but equal) specializations. Well, the internal error is in any case a bug, so if this appears also with the latest (trunk) version, a bug report would be useful. Tomas ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Errors using generics - what is wrong?
Tomas Hajny wrote: Well, the internal error is in any case a bug, so if this appears also with the latest (trunk) version, a bug report would be useful. I didn't see an internal error? But a more descriptive message would be useful ('specialization not allowed in this context' or so?). Micha ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Errors using generics - what is wrong?
On Wed, October 7, 2009 18:47, Micha Nelissen wrote: Tomas Hajny wrote: Well, the internal error is in any case a bug, so if this appears also with the latest (trunk) version, a bug report would be useful. I didn't see an internal error? But a more descriptive message would be useful ('specialization not allowed in this context' or so?). The original post mentioned Fatal: Internal error 200204175. Tomas ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Errors using generics - what is wrong?
Yes, I had an internal error and now I know why - I used specialization in function params. This gives internal error: procedure asdasd(something: specialize TTwoValuesListUnicodeString); begin end; I'll make a bug report tomorow or a day after. And yes, I think a descriptive message saying to use typed specialization would be nice for those using generics first time. Regards, Zilvinas Tomas Hajny wrote: On Wed, October 7, 2009 18:47, Micha Nelissen wrote: Tomas Hajny wrote: Well, the internal error is in any case a bug, so if this appears also with the latest (trunk) version, a bug report would be useful. I didn't see an internal error? But a more descriptive message would be useful ('specialization not allowed in this context' or so?). The original post mentioned Fatal: Internal error 200204175. Tomas ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel] Errors using generics - what is wrong?
Hello all, I am trying to use generics but compilation fails. Whan I try to use unit with my generic class in my real project I get Fatal: Internal error 200204175 error. When I try to use it in empty Lazarus application (Unit1.pas) and I put - procedure TForm1.Button1Click(Sender: TObject); var lst: specialize TTwoValuesListUnicodeString; begin end; - I get these errors: - Unit1.pas(29,17) Error: Forward declaration not solved constructor TTwoValuesList$UnicodeString.Create; Unit1.pas(30,16) Error: Forward declaration not solved destructor TTwoValuesList$UnicodeString.Destroy; Unit1.pas(32,15) Error: Forward declaration not solved TTwoValuesList$UnicodeString.AddString(UnicodeString,UnicodeString); Unit1.pas(33,14) Error: Forward declaration not solved TTwoValuesList$UnicodeString.GetS1(LongInt):UnicodeString; Unit1.pas(34,14) Error: Forward declaration not solved TTwoValuesList$UnicodeString.GetS2(LongInt):UnicodeString; Unit1.pas(35,14) Error: Forward declaration not solved TTwoValuesList$UnicodeString.Count:LongInt; Unit1.pas(36,14) Error: Forward declaration not solved TTwoValuesList$UnicodeString.GetS2(UnicodeString,Boolean=FALSE):UnicodeString; Unit1.pas(47) Fatal: There were 7 errors compiling module, stopping - my generic class is in another (not Unit1.pas) unit looks like this: - type generic TTwoValuesListTVal = class type private PTwoVal = ^TTwoVal; TTwoval = record FS1: TVal; FS2: TVal; end; var private FLst: TFPList; public constructor Create; destructor Destroy; procedure AddString(S1: TVal; S2: TVal); function GetS1(i: Integer): TVal; function GetS2(i: Integer): TVal; overload; function Count: Integer; function GetS2(S1: TVal; isSorted: Boolean = false): TVal; overload; published property Items: TFPList read FLst; end; - What am I doing wrong? Regards, Zilvinas Ledas ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Errors using generics - what is wrong?
Sorry, I forgot to mention I am using Free Pascal Compiler version 2.3.1 [2009/09/08] for i386 (don't know how to get more specific version info...) Žilvinas Ledas wrote: Hello all, I am trying to use generics but compilation fails. Whan I try to use unit with my generic class in my real project I get Fatal: Internal error 200204175 error. When I try to use it in empty Lazarus application (Unit1.pas) and I put - procedure TForm1.Button1Click(Sender: TObject); var lst: specialize TTwoValuesListUnicodeString; begin end; - I get these errors: - Unit1.pas(29,17) Error: Forward declaration not solved constructor TTwoValuesList$UnicodeString.Create; Unit1.pas(30,16) Error: Forward declaration not solved destructor TTwoValuesList$UnicodeString.Destroy; Unit1.pas(32,15) Error: Forward declaration not solved TTwoValuesList$UnicodeString.AddString(UnicodeString,UnicodeString); Unit1.pas(33,14) Error: Forward declaration not solved TTwoValuesList$UnicodeString.GetS1(LongInt):UnicodeString; Unit1.pas(34,14) Error: Forward declaration not solved TTwoValuesList$UnicodeString.GetS2(LongInt):UnicodeString; Unit1.pas(35,14) Error: Forward declaration not solved TTwoValuesList$UnicodeString.Count:LongInt; Unit1.pas(36,14) Error: Forward declaration not solved TTwoValuesList$UnicodeString.GetS2(UnicodeString,Boolean=FALSE):UnicodeString; Unit1.pas(47) Fatal: There were 7 errors compiling module, stopping - my generic class is in another (not Unit1.pas) unit looks like this: - type generic TTwoValuesListTVal = class type private PTwoVal = ^TTwoVal; TTwoval = record FS1: TVal; FS2: TVal; end; var private FLst: TFPList; public constructor Create; destructor Destroy; procedure AddString(S1: TVal; S2: TVal); function GetS1(i: Integer): TVal; function GetS2(i: Integer): TVal; overload; function Count: Integer; function GetS2(S1: TVal; isSorted: Boolean = false): TVal; overload; published property Items: TFPList read FLst; end; - What am I doing wrong? Regards, Zilvinas Ledas ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Errors using generics - what is wrong?
Žilvinas Ledas schreef: Hello all, I am trying to use generics but compilation fails. Whan I try to use unit with my generic class in my real project I get Fatal: Internal error 200204175 error. When I try to use it in empty Lazarus application (Unit1.pas) and I put - procedure TForm1.Button1Click(Sender: TObject); var lst: specialize TTwoValuesListUnicodeString; begin end; - I get these errors: - I would try to use a named type: type TTwoUnicodeValuesList = specialize TTwoValuesListUnicodeString; procedure TForm1.Button1Click(Sender: TObject); var lst: TTwoUnicodeValuesList; begin end; Vincent ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Errors using generics - what is wrong?
Vincent Snijders wrote: I would try to use a named type: type TTwoUnicodeValuesList = specialize TTwoValuesListUnicodeString; procedure TForm1.Button1Click(Sender: TObject); var lst: TTwoUnicodeValuesList; begin end; Vincent Thanks, it works with named type. Is using not named specializations is some kind of not implemented yet part? :) Regards Zlvinas Ledas ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel