I would like to define a record type (type alias) for a generic record. I would like to do this so users of unit b can have access to TMyGenericRecord without using unit a. I have units like this:
unit a;
interface
type
TMyNormalRecord = record
Item: Integer;
end;
TMyGenericRecord<T> = record
Item: T;
end;
implementation
end.
unit b;
interface
type
TMyNormalRecord = a.TMyNormalRecord; // works
TMyGenericRecord<T> = a.TMyGenericRecord<T>; // E2508 type parameters not allowed on this type
implementation
end.
The simple answer to the question is that the language does not support generic type aliases.
The only places where you can use generic parameters are:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With