I was hacking around with CoffeeScript and the need to share part of some functionality between unrelated classes came up.
These two classes are completely unrelated except for the fact that they both are movable. So here’s a simple way to introduce a mixin keyword of sorts into CoffeeScript class scope.
Movable can contain both functions and objects, it will work the same way as if they were defined directly in the class.
This is a very straightforward and simple implementation, it provides no inheritance mechanism to mixins like Ruby does,
but for most cases this is enough.