[fpc-pascal] specialize, identifier not found

Santiago A. svaa at ciberpiula.net
Thu Dec 17 11:18:06 CET 2015


El 16/12/2015 a las 21:01, Sven Barth escribió:
> Mode Delphi follows Delphi's syntax, thus no "generic" and
> "specialize" keywords.
Yes, you are right. I was just looking the objfpc syntax.
>
> The problem isn't default indexed properties. I guess your TRegAlias
> is a record, thus it will be victim of this:
> http://wiki.freepascal.org/User_Changes_2.4.0#Treating_direct-mapped_properties_as_regular_fields

Yes, it looks like that's the problem.

TReg=record
  regField_1:string;
  regField_1:string;
end;

TMyObject=object
  ...
  property Reg:TReg read getReg write setReg;
end;

Var myObject:TMyObject;

I Can't do this:

myObject.reg.regField_1:='A';
myObject.reg.regField_2:='B';

I have to do this:

var auxReg:TReg;
...
auxReg:=myObject.reg;
auxReg.regField_1:='A';
auxReg.regField_2:='B';
myObject.reg:=auxReg;

I can live with no passing them as var parameters, but I thing it is a
little cumbersome for setting fields.  I will try using pointers.

Thanks, it was driving me mad.

-- 
Saludos
Santiago A.




More information about the fpc-pascal mailing list