[fpc-pascal] Constants in generics

Ryan Joseph ryan at thealchemistguild.com
Thu Jan 3 02:03:08 CET 2019



> On Jan 2, 2019, at 3:13 PM, Alexander Shishkin via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
> 
> I`d like to see constant parameter to be constrained with type
> 
> type
> 	generic TList<T; U: Integer> = record
> 		list: array[0..U-1] of T;
> 		function capacity: integer;
> 	end;

This is the syntax we’ve settled on.

type
	generic TList<T, const U: integer> = record
		list: array[0..U-1] of T;
		function capacity: integer;
	end;

Regards,
	Ryan Joseph




More information about the fpc-pascal mailing list