[fpc-pascal] Interface delegates and the implements property specifier

Ryan Joseph genericptr at gmail.com
Sun Dec 22 20:17:30 CET 2019



> On Dec 22, 2019, at 5:26 AM, Sven Barth via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
> 
> You don't seem to understand what implementing an interface means in Object Pascal. It means that a class can be cast to an interface. It does *not* mean that the interface's methods are available from that class.

I guess I'm not seeing the design pattern which they was invented for and I've never come across it in my own work. Not against the idea in any way however.

My mind went in the same direction as Adriaan's did when I saw "implements" I thought that one class could be built from many smaller classes but share the same namespace (like in multiple inheritance or entity/component designs). If a class implements an interface via a delegate then I would expect this to function the same as inheritance, i.e. the namespaces are merged and share functions. Doesn't that make sense?

Maybe what I mean to say is that there's a need for a delegation syntax that functions like multiple inheritance and avoids the traps of deeply nested single inheritance hierarchies. Does anyone else agree? 

Regards,
	Ryan Joseph



More information about the fpc-pascal mailing list