[fpc-pascal] mixin feature
Marco van de Voort
marcov at stack.nl
Thu Dec 24 10:59:53 CET 2009
In our previous episode, Jonas Maebe said:
> >> I think the regular way to do this in Object Pascal is via implements-style delegation (which doesn't really fake mixins; I think it provides exactly the same functionality, just using a slightly different concept). I don't think that's already fully functional in FPC, but Florian and Sergei (Gorelkin) have recently improved it quite a bit.
> > Yes. I also think class helper feature may provide similar functionality.
> No, class helpers add a certain method to a particular class. They don't
> declare a generic implementation that can be added to multiple other
> classes (except if these other classes inherit from the class the method
> was added to).
Not even that afaik. They make a static method appear as it is a member of a
class namespace, and only if you import it correctly.
I don't think class helpers are a real language instrument. They are more a
workaround for certain cases when other classes are set in stone.
More information about the fpc-pascal