[fpc-devel] Failure to recompile TAChart after FPC r40785 (committed by Jonas)

Mattias Gaertner nc-gaertnma at netcologne.de
Mon Jan 7 20:12:26 CET 2019


On Mon, 7 Jan 2019 19:24:53 +0100
Jonas Maebe <jonas at freepascal.org> wrote:

> On 07/01/19 17:32, Mattias Gaertner via fpc-devel wrote:
> > True, reason is that *non* static means there is a Self.
> > But since there is no "object of objecttype" and no "record of
> > recordtype", there is no type for Self in class methods of
> > objects/record.  
> 
> Object class methods do have a self parameter. If an object has a
> vmt, the object class methods get this vmt pointer passed as self
> parameter. Otherwise they get nil as self parameter. Kylix does not
> support calling object class methods through tobjecttype.classmethod
> either, which is indeed kind of strange.

Thanks. I learned something new.

But what is this Self?

  TBird = object
    class procedure DoIt; virtual;
  end;

class procedure TBird.DoIt;
var
  o: TBird;
begin
  o:=Self; 
  // Error: Incompatible types: got "Class Of TBird" expected "TBird" 
end;

But "Class Of TBird" does not exist in FPC, does it?

 
> It is not possible to declare a non-static class method (in FPC, at 
> least; Kylix does not support "advanced records", so I cannot test
> there).

Mattias



More information about the fpc-devel mailing list