The Bix spinoff project that provides C# mixins is nearing release. I have very good test coverage with no known bugs.

Cilador Weaver was formerly known as Bix.Mixers

Updated 2014-04-20 to remove generics support from the initial release

What's Done?

  • Mixin target types are marked with an attribute that specifies the mixin definition interface.
  • Mixin implementation types are specified in configuration. One implementation type is configured per definition interface.
  • The mixin definition interface gets added to the mixin target type.
  • Fields, methods, properties, events, and nested types are copied from the non-abstract mixin implementation type to the target type.
  • Static members of mixin implementation types are copied into the target type, as well as instance members.
  • Member are copied from the mixin implementation type to the mixin target type by default. It does not matter whether they are part of the mixin definition interface.
  • Annotating a mixin implementation member with a SkipAttribute will keep the mixer from copying that member to the target type.
  • Nested reference types, values types, interfaces, enumerations, and delegates are all supported.
  • Nested types may be abstract.
  • Implementation type methods may be virtual. Methods within nested types may be virual or abstract.
  • Interfaces and events can be implemented implicitly or explicitly in the mixin, and they will be mixed into the target type as they are written.

What's Left?

  • Support for generic methods is on track for this release.
  • Support for nested open generic types is also on track for this release.
  • Mixin reference redirection is complete, but it is only partially tested. It will be fully tested for this release. [1]
  • A decision on what to do about type initializers, a.k.a. C# static constructors, needs to be made.
  • Currently constructors are copied along with everything else, which means that you have to be careful about putting SkipAttributes on empty constructors. Constructor control should be more intelligent, and this release may or may not change constructor handling.
  • Several unsupported scenarios need to be explicitly checked for so that errors and warnings can be raised.
  • Some work needs done on simplifying configuration.
  • Documentation, both code level and project level, needs completed.
  • The NuGet package needs to be created and tested.

What's Unsupported

  • Field initial values will not be supported in this release. In IL, field initialization happens in constructors before calling the base constructor, so any movement on this is dependent on final decisions on constructor behavior.
  • Mixin definition interfaces are not allowed to be generic.
  • Mixin implementation types are not allowed to be generic.
  • Mixin implementation types are not allowed to be abstract.
  • Mixin implementation types are not allowed to inherit from any type other than System.Object
  • Mixin implementation types are not allowed to implement interfaces other than the Mixin definition interface.
  • Naming collisions are not resolved. Member name collisions between a mixin implementation and a target will cause an error. For members of the mixin definition interface, this can be avoided by implementing members explicitly. For members that are not defined on the interface, there is no remediation.
  • Support for generic methods and nested open generic types will not be included in this release [Added 2014-04-20]

When?

If this is not completed within the next week, then it will likely another month after that, as my family and I are moving in two weeks, and that will soon start to dominate my time. I will do everything I can to finish in the next week, which would be by 4/25.

[1] Mixin reference redirection occurs when an implementation member references another member. Upon mixing, that reference is modified to point to the version of the member within the mix target.