> On Jan 2, 2019, at 5:52 PM, Alexander Shishkin via fpc-pascal 
> <fpc-pascal@lists.freepascal.org> wrote:
> 
> Thanks, now I`ve lost is a discussion again. What is the decision about 
> syntax? Is "const" prefix and/or ": type" suffix required?

const is required but the type is not.

Here’s a test for all the const types supported.

program gc_types;
uses
        sysutils;

type
        generic TMyRecord_Int<T, const U:integer> = record
        end;

type
        generic TMyRecord_Byte<T, const U:byte> = record
        end;

type
        generic TMyRecord_String<T, const U:string> = record
        end;

type
        generic TMyRecord_Float<T, const U:single> = record
        end;

type
        TDay = (Mon, Tue, Wed);
        TDays = set of TDay;
        generic TMyRecord_Set<T, const U:TDays> = record
        end;

type
        generic TMyRecord_Nil<T, const U:pointer> = record
        end;


type
        generic TMyRecord_Undefined<T, const U> = record
        end;

var
        a: specialize TMyRecord_Int<integer,10>;
        b: specialize TMyRecord_String<integer,'foo'>;
        c: specialize TMyRecord_Float<integer,0.1>;
        d: specialize TMyRecord_Set<integer,[Mon, Wed]>;
        e: specialize TMyRecord_Nil<integer,nil>;
        f: specialize TMyRecord_Byte<integer,kByte>;
        g: specialize TMyRecord_Undefined<integer,[1,2,3]>;
begin
end.


Regards,
        Ryan Joseph

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to