[fpc-devel] generic forward declaration?

2025-07-29 Thread Martin Frb via fpc-devel
Are there? Or is there something else? The below compiles. No duplicate TBar. Looks like a forward declaration... program Project1;{$Mode objfpc} type   generic TBar = class; // forward   generic TBar = class     F:A;     X:B;   end; begin end. But the next does not compile "Identifier not

Re: [fpc-devel] generic forward declaration?

2025-07-29 Thread Michael Van Canneyt via fpc-devel
On Tue, 29 Jul 2025, Martin Frb via fpc-devel wrote: Are there? Or is there something else? The below compiles. No duplicate TBar. Looks like a forward declaration... program Project1;{$Mode objfpc} type   generic TBar = class; // forward   generic TBar = class     F:A;     X:B;   end; beg

Re: [fpc-devel] generic constraints...

2025-07-29 Thread Mattias Gaertner via fpc-devel
On 7/25/25 16:31, Martin Frb via fpc-devel wrote: On 25/07/2025 15:20, Mattias Gaertner via fpc-devel wrote: On 7/25/25 13:44, Martin Frb via fpc-devel wrote: Currently you can't do type    generic TFoo = class   procedure Bar; virtual;    end;    generic FooChild = class(F)   pro

Re: [fpc-devel] generic constraints...

2025-07-29 Thread Michael Van Canneyt via fpc-devel
On Tue, 29 Jul 2025, Mattias Gaertner via fpc-devel wrote: And each list needs to be   TMyFinalItem1 =    specialize TFeatureXForList<    specialize TFeatureYForList<    specialize TFeatureZForList< specialize TFpgList   >   >   >; IMO that does no

Re: [fpc-devel] generic constraints...

2025-07-29 Thread Martin Frb via fpc-devel
On 29/07/2025 09:53, Mattias Gaertner via fpc-devel wrote: On 7/25/25 16:31, Martin Frb via fpc-devel wrote: But     generic FooChild = class(F) - F is not a variable - TFoo in not a type (for somethnig), TFoo is a constraint The problem is the ambiguity of TFoo, because Delphi (aka modeswi

Re: [fpc-devel] generic forward declaration?

2025-07-29 Thread Martin Frb via fpc-devel
On 29/07/2025 09:36, Michael Van Canneyt wrote: Same here, you're missing a type parameter. TFoo needs 2 type parameters. Ups, thanks. Any obvious  (or non obvious) mistake of mine in the below? Because either of the 2 commented specialize cause errors in the generics... (but only if TFoo.F 

Re: [fpc-devel] generic forward declaration?

2025-07-29 Thread Sven Barth via fpc-devel
Martin Frb via fpc-devel schrieb am Di., 29. Juli 2025, 20:57: > On 29/07/2025 09:36, Michael Van Canneyt wrote: > > Same here, you're missing a type parameter. TFoo needs 2 type parameters. > > Ups, thanks. > > Any obvious (or non obvious) mistake of mine in the below? > > Because either of the