[fpc-pascal] Error: Argument cannot be assigned to

Michael Van Canneyt michael at freepascal.org
Mon Jun 5 08:39:12 CEST 2023



On Sun, 4 Jun 2023, Juha Manninen via fpc-pascal wrote:

> On Sunday, June 4, 2023, Mattias Gaertner via fpc-pascal <
> fpc-pascal at lists.freepascal.org> wrote:
>
>>
>> Correct. Property RecInstance is read only.
>>
>
> No, I can define it as :
>    property RecInstance: TMyRec read fRecInstance write fRecInstance;
> and still get the same error.

Because properties can have getters and setters, it follows that
you can only read/write a property as a whole, never a part.

What you will do in your case is read the property in a temp location,
change the temp location and that's it. The original location is unmodified.

There is a bug in fpc (as mentioned by Sven and Martin) that violates this
principle, but as Sven said, this will be fixed.

Michael.


More information about the fpc-pascal mailing list