[fpc-devel] Object upgrades

Ryan Joseph genericptr at gmail.com
Mon Jun 10 20:31:00 CEST 2019



> On Jun 10, 2019, at 2:26 PM, Sven Barth via fpc-devel <fpc-devel at lists.freepascal.org> wrote:
> 
> Also FPC doesn’t have something “self” but for the class level so you need to cast the return value. Btw adding “ClassSelf” is something I’ve wanted for a while, so I can reference the class type within the class declaration.
> 
> What are you talking about here? 
> 

Like this. I would prefer there being a “ClassSelf” type or something which acted as TSelf.

type
	TRecord = record
		public type
			TSelf = TRecord;
		public
			class operator + (left: TSelf; right: integer): TSelf;
			class operator + (left: TSelf; right: integer): TSelf;
			class operator - (left: TSelf; right: integer): TSelf;
			class operator * (left: TSelf; right: integer): TSelf;
			class operator / (left: TSelf; right: integer): TSelf;
			class operator ** (left: TSelf; right: integer): TSelf;
			class operator div (left: TSelf; right: integer): TSelf;
			class operator mod (left: TSelf; right: integer): TSelf;


Regards,
	Ryan Joseph




More information about the fpc-devel mailing list