mixins

Mixins and .net

What are, exactly mixins? Are there any techniques to achieve that in c#? ...

How can I aggregate interfaces into with castle dynamic proxy

I would like to allow for declarative mixin management in my codebase. I would like to declare an interface like public interface IMyRepo : IRepository, ICanFindPeopleByName, ICantSing {} So my classes can consume only the bits of the data access layer they need. In my IoC container I would like to aggregate the implementations of t...

making a SingletonMixin class in c++

Hi guys: I have four classes, let's call S1, S2, S3 and S4. These class are singletons; each one have a getInstance and a finalize method - and an instance private variable-. Now, to avoid repeting the finalize and getInstance methods I'm trying to make a SingletonMixin class, something like: template<class T> class SingletonMixin { ...

How to apply a "mixin" class to an old-style base class

I've written a mixin class that's designed to be layered on top of a new-style class, for example via class MixedClass(MixinClass, BaseClass): pass What's the smoothest way to apply this mixin to an old-style class? It is using a call to super in its __init__ method, so this will presumably (?) have to change, but otherwise I'd l...

How to mixin and call link_to from controller in Rails?

This seems like a noob question, but the simple answer is eluding me. I need to call link_to in an ActionController method to spit out an HTML link. ActionView::Helpers::UrlHelper.link_to calls url_for, but this calls the AV module's version instead of the controller's. I managed to coerce this into doing what I intended by putting #...

How can I use mixins or modules in my controllers in Rails 3?

I have some behavior in my controller that I pulled out into a module in order to test better and re-use it in a few places. Two questions about this: Where is a good place to put my modules? They need to run in order to be available to the controllers, so I was thinking the config/initializers/ directory. That seems a little suspect t...

Multi-nested, multi-block mixins in lessphp

While transforming some code to lessphp from the classic less code; an incompatibility I discovered from the classic less css is that there is no support for multi-block mixins with nesting levels > 2. The classic less seems to be fully in support of mixins having many nested blocks in them. Is this intentional - the support for just tw...