Show quoted text 15 lines
On Jul 24, 2020, at 6:07 AM, Kostas Michalopoulos via fpc-devel wrote:
There should be at least support for operators. I have a custom
dynamic array object type (i use objects instead of classes to avoid
unnecessary heap allocations) which would benefit a lot from such
support. I worked around not having management operators by putting
the data fields and core functionality inside a generic advanced
record which implements these operators and then using that inside the
object (so the values do get released automatically when the object
itself is released), but i also need support for at least the equality
operator as the dynamic array object has an IndexOf method that uses
that and it cannot be used with other dynamic arrays (so i cannot have
a dynamic array object which itself contains dynamic array objects
because i cannot provide a = operator for the dynamic array object
itself).
I thought the core team was going to accept this patch because it doesn't really have any downsides. Classes should be able to support operator overloads also provided they don't return the class type itself (this was discussed at length with Sven) so at the very least =, >, < etc... should be supported. If the first patch ever gets accepted I would like to extend it to do that also.
Regards,
Ryan Joseph