[fpc-pascal] mixin feature

Jonas Maebe jonas.maebe at elis.ugent.be
Thu Dec 24 10:56:13 CET 2009


On 24 Dec 2009, at 10:41, Bee Jay wrote:

>> 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).

> But AFAIK FPC doesn't yet support either feature. :(

As I said, at least svn trunk already supports implements-style delegation to a certain extent (and even 2.4.0 partially supports it). And you can of course also use a regular delegation pattern, since mixins are basically a form of automated delegation (and once interface delegation fully works in the compiler, you can remove your manual wrappers).


Jonas


More information about the fpc-pascal mailing list