05.10.2017 2:07 PM "Marcos Douglas B. Santos" <m...@delfire.net> napisał(a):
On Thu, Oct 5, 2017 at 5:55 AM, Ryan Joseph <r...@thealchemistguild.com> wrote: > >> On Oct 5, 2017, at 12:28 PM, Sven Barth via fpc-pascal < fpc-pascal@lists.freepascal.org> wrote: >> >> 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. >> >> > > 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. > As Sven told you, just use COM Interfaces. Look this explanation -> http://castle-engine.io/modern_pascal_introduction. html#_corba_and_com_types_of_interfaces but don't pay attention when to author says "Ugly (COM) interfaces" because it is not. :) Really, it is not. 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. 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. 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"). Regards, Michalis
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal