2016-06-20 14:30 GMT+02:00 Marcos Douglas <m...@delfire.net>: > Don't agree with "Ugly (COM) interfaces". Yeah, _AddRef, _Release, > QueryInterface is ugly implementation but reference-counting mechanism > is nice. >
Reference-counting is a useful concept, but "entangling" it with interfaces is somewhat ugly IMHO. Those two concepts, and needs, should be unrelated language features in my opinion: - you use interfaces when you want to cast a class to multiple possible interfaces, - you use reference-counting to get automatic memory management (to some extent, e.g. beware of cycles). Both of these are useful, but forcing them together seems ugly. And it causes actual problems: - Various classes, using standard TComponent, have to "hack around" reference counting by proving _AddRef implementations that do nothing, - Even with hack above, you need to be extra careful about interface temporary variables (you cannot free the class instance, if some temporary interface variable may refer to it). Regards, Michalis _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal