I implemented a first draft of constants (integers) in generics. My reason was specifically that I wanted a way to add methods to static arrays and generic records is the only way to accomplish this AFAIK.
If I fix this up will it be considered as a patch? I wanted to present the idea first before I spent any more time. Here’s what I has so far (on GitHub). https://github.com/genericptr/freepascal/commit/ec518542b2da7d7f016702a82b2d05349a01a6fb {$mode objfpc} {$modeswitch advancedrecords} program generic_constants; type generic TList<T, U> = record list: array[0..U-1] of T; function capacity: integer; end; function TList.capacity: integer; begin result := U; end; var nums: specialize TList<integer,10>; strs: specialize TList<integer,4>; begin writeln('sizeof:',sizeof(nums), ' capacity:',nums.capacity); writeln('sizeof:',sizeof(strs), ' capacity:',strs.capacity); end. Regards, Ryan Joseph _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal