Mikael Amborns facet implementation is finally checked into Pike. Facets allows you to enforce that a multiple inheritance is used when functionality is split into several classes.
One current misfeature is that the facet group object needs to exist before (e.g. loader wrapper) or be created during compilation (e.g. .pmod file).
Usage example:
add_constant( "Bunny", FacetGroup() );
(1) Result: 0
class White { facet Color:Bunny; } class Black { facet Color:Bunny; } class Small { facet Size:Bunny; } class Large { facet Size:Bunny; } class Snuffy { inherit White; inherit Small; } class Sooty { inherit Black; }
Compiler Error: 1:Error in some product classes Compiler Exception: Product class does not inherit from all facets. _static_modules.Builtin()->facet_group: _static_modules.Builtin()->facet_group()->check_product_classes()
class Checkers { inherit Black; inherit White; }
Compiler Error: 1:Unable to add product class Compiler Exception: Product class can only inherit from one class in every facet. _static_modules.Builtin()->facet_group: _static_modules.Builtin()->facet_group()->add_product_class(65713,0,65701)
Another problem is that it leaks all kinds of stuff (parser stack, objects and strings)...