[fpc-devel] Assign Self

Micha Nelissen micha at neli.hopto.org
Sat Jul 11 13:42:51 CEST 2009


Jonas Maebe wrote:
> Note that some hits, like the one in cgbase.pas of FPC, refer to the 
> self parameter of objects, not of classes.

... or a local variable or a field in a record ...

Only ones I found are TExpression and TContractForm, but those don't win 
a readability contest, like below one in which self is abused as a kind 
of temporary variable of the "right" type:

procedure tcontractform.add;
begin
   self:=tcontractform.create(owner);
   self.insert.enabled:=true;
   self.btnregion.enabled:=true;
   self.showmodal;
end;

Gives me the creeps, but I guess nothing strange will happen as other 
people's references to the "original" Self aren't modified.

Micha



More information about the fpc-devel mailing list