Adding mixins to an instance

I often want to attach little bits of meta data to certain instances of an object without all the hassle of declaring a million and one types.  If I have a set of 5 mixins that I want to add in various combinations to a concrete class there are like 5! new classes I have to create to get them all.  What I often want is to just add a mixin to a specific instance of a class and let that instance’s init args/fns handle the rest.  I was able to accomplish this (with help from vic on #lisp) with the meta-mixin mixin.  Applied to a class, it lets you pass a list of mixins as an initarg and will change the class of your running object to one that contains all the superclasses requested in the correct order (and with the same metaclass) as the original object.

I found this to be a nifty, useful way to interact with my objects.  Check out the paste for code and example.