<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body smarttemplateinserted="true">
<div id="smartTemplate4-template">Hi',<br>
<br>
<p>
<blockquote type="cite"><br>
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 <br>
</blockquote>
</p>
<p><br>
</p>
<p>One need would be to automatically call the destructor</p>
<p>It could make the code much simpler, especially when it also
replaces try..finally, and prevent memory leaks<br>
</p>
<p><br>
<blockquote type="cite"> Just leave the poor, old objects alone.
<br>
</blockquote>
<br>
</p>
Objects are much more useful than classes or records<br>
<br>
Bye,<br>
Benito </div>
<br>
<div class="moz-cite-prefix">Am 15.06.19 um 18:50 schrieb Sven Barth
via fpc-devel:<br>
</div>
<blockquote type="cite"
cite="mid:ce397a48-65b7-8f5b-b130-745e0503fc93@googlemail.com">Am
15.06.2019 um 17:17 schrieb Ryan Joseph:
<br>
<blockquote type="cite">{ 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 }
<br>
<br>
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.
<br>
<br>
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:
<br>
<br>
1) don’t allow management operators in objects (that would be
very unfortunate indeed).
<br>
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).
<br>
3) allow overriding of operators. I don’t think that would be
make sense or perhaps even possible.
<br>
</blockquote>
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.
<br>
<br>
Regards,
<br>
Sven
<br>
_______________________________________________
<br>
fpc-devel maillist - <a class="moz-txt-link-abbreviated" href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a>
<br>
<a class="moz-txt-link-freetext" href="https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel">https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel</a>
<br>
</blockquote>
</body>
</html>