Hi',
I don't see a need to add management operators to objects. Objects
have constructors and destructors, so they don't need Initialize and
Finalize operators
One need would be to automatically call the destructor
It could make the code much simpler, especially when it also replaces
try..finally, and prevent memory leaks
Just leave the poor, old objects alone.
Objects are much more useful than classes or records
Bye,
Benito
Am 15.06.19 um 18:50 schrieb Sven Barth via fpc-devel:
Am 15.06.2019 um 17:17 schrieb Ryan Joseph:
{ I think the old thread “Object upgrades” got broken during the
server move so I’ll try to start a new thread and see if this gets
posted }
Another question. I’m not sure it’s possible but I did try to add
management operators to objects and found that if a initialize
operator was declared in a unit which was precompiled and then
inherited from an object in another unit which declared another
initialize operators, the initialize operator would be called twice.
The issue is that the operator is compiled into some other code which
always gets called when the object is used as a var type. Is there
any work around to that? The options I’m aware of are:
1) don’t allow management operators in objects (that would be very
unfortunate indeed).
2) don’t allow subclasses to redeclare a management operator (that
seems ok since the operator can call a virtual method from the base
class).
3) allow overriding of operators. I don’t think that would be make
sense or perhaps even possible.
I don't see a need to add management operators to objects. Objects
have constructors and destructors, so they don't need Initialize and
Finalize operators and they have a defined assignment operation. Just
leave the poor, old objects alone.
Regards,
Sven
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel