Sven Barth wrote 24 lines
Am 16.12.2015 16:12 schrieb "Santiago A." <
>:
>
> Type
> TRegAlias=record
> AliasName:string
> ...
> end;
>
> TArrayAlias=specialize TArray<TRegAlias>; // <==== Error here
>
> defconexion.pas(71,14) Error: Identifier not found "specialize"
> defconexion.pas(71,25) Error: Error in type definition
> defconexion.pas(71,25) Fatal: Syntax error, ";" expected but "identifier
> TARRAY" found
>
>
> Why this error?
> Why does the compiler try to look for a Identifier "specialize" instead
> of interpreting it as a reserved word?
Which FPC version? Which language mode?
{$mode Delphi}
I've just tried {$mode objfpc} and compiles type declaration, (Delphi mode can't understand generics?)
But now I have another problem, when I use the variable, I get "Argument can't be assigned to"
var
arrayAlias:TArrayAlias;
aliasList:TStringList;
...
begin
...
arrayAlias[i].AliasName:=aliasList[i]; //<==== Error here
Where TArrayAlias=TArray<TRegAlias>, and TArray<_T> is an object, not a class.
And it has a property
property item[index:Integer]:_T read getItem write setItem; default;
So, it has the getter and the setter.
Doesn't objfpc mode accept default indexed properties?
Saludos
Santi