How long has the syntax below been valid in pascal and is there somewhere I can look to see how it works ?
I was always trying lots of IFs, THENs etc. in the past.
procedure TForm1.Button1Click(Sender: TObject);
begin
Shape1.visible := not Shape1.visible;
end;
well I'll give a try with a semi-technical explantation, I hope this will work.
if Shape1.Visible is a field:
read Shape1.Visible into scratch%1
assign scratch%1 to not scratch%1
write scratch%1 into Shape1.Visible
if Shape1.Visible is a function (both setter, getter):
call Shape1.Visible put result in scratch%1
assign scratch%1 to not scratch%1
call Shape1.Visible with scratch%1 as parameter
now, the problem is that Visible is certainly a property so depending on the "read" "write" what will happend can be a mix of the two.
otherwise... when it's not a function you have a dot operator... the dot LHS gives the address and the dot RHS an offset (basically because with several dots its different). But in both cases (read/write) you have an adress to read or write given bu the expression.
when it's a function things get more complicated...
if Shape1 is variable and not a type then Shape1 still gives an adress but this address is called a "this" (or a "self").
Visible is a function of that takes an instance of Shape1 type as hidden parameter, so this function is called with the address of Shape1 as hidden param and also the other regular params. You see member functions are just an abstraction.But there are also static member functions or class functions... in this case Shape1 is just used to resolve and there's no hidden parameter.