in Delphi TIPS :: According to the "Proper using of a Record Field/Property in a Class" poll, only 20+% of Delphi developers know what usage of a Record Delphi type as a Property in a Class declaration will produce a compile time error while trying to assign a value to a record's field.
If you expose a Record type variable as a property of a Delphi class, trying to assign a value to one of record fields will result in "left side cannot be assigned to", as in:
objectInstance.RecordAsProperty.Field := SomeValue; // erorr!
Read the full article to find out how to why this does not compile and how to fix the left side cannot be assigned to error.
Related: Understanding the Record Type in Delphi | Learning Object Oriented Programming with Delphi | Statements, Properties, Variables for Beginners


Besides that… for beginners, make sure the left side is not declared as a constant!
The 2010 compiler was fixed up to correctly report errors in some cases around left-side-cannot-be assigned, and this fix broke some badly written code that users had already compiled just fine in earlier versions.
Here’s some sample code:
type
TRec = record
C:Integer;
end;
TClass1 = class
protected
FB:TRec;
public
property B:TRec read FB;
end;
….
var
…
implementation
….
procedure TForm1.Button1Click(Sender: TObject);
var
A:TClass1;
begin
A := TClass1.Create;
A.FB.C := 1; // no problem.
A.B.C := 1; // Left side cannot be assigned
// (All delphi versions report this error)
// Only delphi 2010 reports this as
// “Left side cannot be
//assigned” error:
with A.B do begin
C := 1;
end;
end;
…code snippet ends…
Warren