Renaming a TValue Array Type

I had a strange thing about renaming the type of the TValue array, for example:

TValueArray1 := TArray <TValue>;
TValueArray2 := Array of TValue;

I want to say that they should not behave the same? I have a method that has a constant TValue open array as an argument, but when I replace it with any TValueArray, the compiler starts to expect ordinal values, why?

For example, it works correctly;

// G1 - TGUID; B1 - TBytes; I1 - Integer; S1 - String

procedure TAgBuffer.Add ( const AData: Array of TValue );
TAgBuffer.Add ( [(TValue.From <TGUID> ( G1 )), TValue.From <TBytes> ( B1 ), I1, S1] );

But after replacing "Array of TValue" with any TValueArray, it produces the following compiler errors: -

[dcc32 Error] Unit1.pas(44): E2001 Ordinal type required // for G1
[dcc32 Error] Unit1.pas(44): E2010 Incompatible types: 'Integer' and 'TValue' // for B1
+4
source share
2 answers

You seem to be asking why these two are different:

procedure foo1(const a: array of Integer);
procedure foo2(const a: TArray<Integer>);

, foo1 , foo2 - . . , .

, , . , .

+4

All Articles