[fpc-pascal] Constants in generics
fpc at mfriebe.de
Wed Nov 7 12:51:47 CET 2018
On 06/11/2018 08:13, Ryan Joseph wrote:
> 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).
Just for info, there already is a way to do this, though being able to
do it direct would be nice. You can wrap any constants into an object
(or advanced record).
generic Foo<A> = object
class procedure test;
Data = object
const val = 1;
bar: specialize Foo<data>;
class procedure Foo.test;
More information about the fpc-pascal