Ryan Joseph <r...@thealchemistguild.com> schrieb am Fr., 17. Aug. 2018, 18:22:
> > > > On Aug 16, 2018, at 8:55 AM, Sven Barth via fpc-pascal < > fpc-pascal@lists.freepascal.org> wrote: > > > > It shouldn't be hard. Feel free to provide a patch together with some > tests and it will be taken under consideration. > > So the reason that objects/classes in FPC don’t have operators in the > class (like advanced records) is for Delphi compatibility? That would be > great if operators were unified across records/classes. > Not entirely. In Delphi objects are deprecated, so as long as old code keeps compiling and running we can mess with them. However for classes there is the problem of temporary variables. Take a := b + c + d. That is essentially compiled as t := b + c; a := t + d. The compiler does not know whether the operator creates an instance or not (yes, there are circumstances when it can know that, but for the general case it can't) and thus this would potentially lead to memory leaks. Thus automatic reference counting or garbage collection or something like that is required for this to work nicely. Regards, Sven >
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal