I have a record type defined like:
type
TRecordType = record
Field1: string;
Field2: Variant;
end;
And a function declaration using it:
function Function1(const Records: TArray<TRecordType>): TAnyOtherClass;
So far so good, but if the function is called like:
Function1([BuildRecord('string', value), BuildRecord('OtherString', otherValue)])
The compiler returns an error:
[DCC Error] AnyUnit.pas(142): E2001 Ordinal type required
I have read some place a long time ago that Delphi's compiler handles generics in a kind of preprocessor with string replacements done before really compiling the code, so I was expecting Function1 to become something like:
function Function1(const Records: array of TRecordType): TAnyOtherClass;
Because TArray is defined TArray<T> = array of T;.
I think it is not happening, because when I changed the function declaration to:
function Function1(const Records: array of TRecordType): TAnyOtherClass;
The code is compiled without errors or warnings.
There is an answer on [this question] 1 that links to an article explaining the difference, but the link there is broken.
So my question is, what means TArray<T> if not array of T?