[fpc-pascal] Property Tags

Thierry Coq tcoq at free.fr
Tue Aug 3 10:40:09 CEST 2010


On 02/08/2010 22:10, Jorge Aldo G. de F. Junior wrote:
> and what about property tags and dynamic dispatch ?
> this would solve a lot of problems of my project...
> (i'm reading about multiple inheritance and looks like it creates more
> problems than it solves...)
Multiple implementation inheritance is quite a bad thing, it can render 
your code unreadable, and beyond that, plain wrong, with the error 
difficult to understand.
The answer in FPC are interfaces. In addition, to solve your particular 
problem, you might want to use generics (now possible in FPC) to limit 
the amount of similar code you write, and also use the responsibility 
and iterator patterns, but implementing them by using event properties 
(procedure of object properties), usually called 
"OnSomethingDoSomething". This should decouple your code nicely.

I hope this helps.

More information about the fpc-pascal mailing list