[fpc-devel] Generic class comparison operators

Ryan Joseph genericptr at gmail.com
Wed Apr 21 16:21:24 CEST 2021



> On Apr 21, 2021, at 7:44 AM, Benito van der Zander via fpc-devel <fpc-devel at lists.freepascal.org> wrote:
> 
> Hi,
> 
>  what about overloading operators for OBJECTs?
> 
> They do not conflict with any default operators.
> 
> I expected this to work, but it did not compile:
> 
> 
> 
>   type generic TXQHashset<TKey, TInfo> = object //(specialize TXQBaseHashmap<TKey,TXQVoid,TInfo>)... 
>     class operator =(const a, b: TXQHashset): boolean;
>   end;

yes I have patch to enable this via a mode switch (https://bugs.freepascal.org/view.php?id=36350) but it has been acknowledged and then ignored without explanation since 2019. This is still the only way we can use operator overloads for generic objects and objects are the only way to have record inheritance so it's a critical missing feature in my opinion.

Regards,
	Ryan Joseph



More information about the fpc-devel mailing list