[fpc-devel] Class management operators

Sven Barth pascaldragon at googlemail.com
Fri May 24 21:17:56 CEST 2019


Ryan Joseph <ryan at thealchemistguild.com> schrieb am Fr., 24. Mai 2019,
17:43:

> Another thing I forget to mention. Since I was looking at management
> operator stuff in the compiler I was curious, why don’t classes support
> management operators? The infrastructure is already there for built-in
> reference types like dynamic arrays/ansistring’s so it would be relatively
> trivial to support classes also. I already spent a good amount of time
> working on “default properties” but that was done in leu of the fact that
> only records support management operators.
>

This is not desired, because it would mean that for *all* assignments
between *any* class type it must be at least checked for management
operators or it must be forbidden that a class type with management
operators can be assigned to a variable of a parent class that does not
have them.
The former is definitely not desired, because it means a performance impact
for otherwise cheap assignment. And the later can become annoying as hell
when you want to pass an instance e.g. to a TNotifyEvent or store it in a
TStringList's Objects property.

Regards,
Sven

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20190524/d24f69e2/attachment.html>


More information about the fpc-devel mailing list