[fpc-pascal] A serious Memleak using delegates/implements (was: Delegate Interface class does not seem to be referenced counted)

Marcos Douglas md at delfire.net
Thu Oct 6 03:49:24 CEST 2016

On Wed, Oct 5, 2016 at 7:03 PM, Graeme Geldenhuys
<mailinglists at geldenhuys.co.uk> wrote:
> Martin Schreiber recently mentioned in another Interface discussion that
> there is a very good reason he doesn’t use COM style interfaces…
> Reference Counting!

I understand you, but reference counting help us to write a better
code, more object-oriented.

> Stick with CORBA style interfaces and things work much simpler. I have
> to agree. I’ve used CORBA style interfaces for years with great success
> and no memory leaks. You get all the benefits of Interfaces, but without
> the Reference Counting troubles and complexities. If you really are
> writing COM (Windows specific) applications, then fine — otherwise use
> CORBA style interfaces.

Simplicity. I think that's depends on point of view.
Today I write a better code than 3~4 years ago. For me it's much more simpler:
- no more .Free
- no more try-finally (to use .Free)
- no inheritance
- less variables and types declarations
- more functional design

I'm using decorator pattern. No problem with it, but delegates makes
me write less code and the design is awesome. None language has the
same feature, as far as I know. We have it, but doesn't work... well,
doesn't work in all cases, in all possibilities.

For me, it's a bug. Sorry.

Best regards,
Marcos Douglas

More information about the fpc-pascal mailing list