[fpc-pascal] Correct way for partial generic specialization

leledumbo leledumbo_cool at yahoo.co.id
Tue Apr 16 16:36:25 CEST 2013


This code:

{$mode objfpc}{$H+}

type
  generic TType1<A,B> = class end;
  generic TType2  = specialize TType1<A,String>;

begin
end.

fails:
x.pas(5,42) Error: Identifier not found "A"
x.pas(5,42) Error: Type identifier expected
x.pas(5,50) Error: Illegal expression
x.pas(7,1) Error: This type can't be a generic

but this code:

{$mode objfpc}{$H+}

type
  generic TType1<A,B> = class end;
  generic TType2  = class(specialize TType1<A,String>) end;

begin
end.

works. Does it have to be like the 2nd code for partial generic
specialization?



--
View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Correct-way-for-partial-generic-specialization-tp5714160.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.



More information about the fpc-pascal mailing list