<div dir="auto"><br><div class="gmail_extra" dir="auto"><br><div class="gmail_quote">05.10.2017 2:07 PM "Marcos Douglas B. Santos" <<a href="mailto:md@delfire.net">md@delfire.net</a>> napisał(a):<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="quoted-text">On Thu, Oct 5, 2017 at 5:55 AM, Ryan Joseph <<a href="mailto:ryan@thealchemistguild.com">ryan@thealchemistguild.com</a>> wrote:<br>
><br>
>> On Oct 5, 2017, at 12:28 PM, Sven Barth via fpc-pascal <<a href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.<wbr>org</a>> wrote:<br>
>><br>
>> The way to go in Object Pascal are reference counted interfaces (aka COM-style interfaces). After all one should program against an interface anyway and that reference counted interfaces are automatically handled by the compiler is an added bonus.<br>
>><br>
>><br>
><br>
> example? I’ve been doing retain management manually and honestly I prefer that for some cases where I want more control so I still like that syntax option.<br>
><br>
<br>
</div>As Sven told you, just use COM Interfaces.<br>
Look this explanation -><br>
<a href="http://castle-engine.io/modern_pascal_introduction.html#_corba_and_com_types_of_interfaces" rel="noreferrer" target="_blank">http://castle-engine.io/<wbr>modern_pascal_introduction.<wbr>html#_corba_and_com_types_of_<wbr>interfaces</a><br>
but don't pay attention when to author says "Ugly (COM) interfaces"<br>
because it is not. :)<br>
<br>
Really, it is not.<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">I hope I explained there why I consider the COM design "ugly": because it puts three often-unrelated features (reference counting, and ability for multiple classes to expose same API safely, and interaction with COM technology) in one bag.</div><div dir="auto"><br></div><div dir="auto"><span style="font-family:sans-serif">In this case, in which you indeed want two of these features simultaneously, I advise COM interfaces myself :) That's why they are documented after all. </span><br></div><div dir="auto"><br></div><div dir="auto">In general, I would prefer these features to be available separately. Like other languages do: interfaces in Java and C# are only to "expose same API from multiple classes" (granted, comparison is unjust as Java and C# just have garbage collection) -- in Pascal you get this by CORBA interfaces. And reference counting like in e.g. C++ "shared pointers", that can wrap any class, without any additional feature (in Pascal we may get this with "management operators").</div><div dir="auto"><br></div><div dir="auto">Regards,</div><div dir="auto">Michalis</div><div dir="auto"><br></div><div dir="auto"><br></div><div class="gmail_extra" dir="auto"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"></blockquote></div></div></div>