[fpc-pascal] specialize, identifier not found

Santiago A. svaa at ciberpiula.net
Wed Dec 16 17:57:44 CET 2015


El 16/12/2015 a las 17:25, Sven Barth escribió:
>
> Am 16.12.2015 16:12 schrieb "Santiago A." <svaa at ciberpiula.net
> <mailto:svaa at ciberpiula.net>>:
> >
> > 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
svaa at ciberpiula.net

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20151216/2d724e6b/attachment.html>


More information about the fpc-pascal mailing list