From: James Edward Gray II Date: 2010-03-22T02:14:12+09:00 Subject: Re: A plugin system using extend On Mar 21, 2010, at 2:13 AM, Jean-denis Vauguet wrote: > Another idea I had is the following: > - any loaded lugin registers as a "callback" for the classes it wants to > alter (instances of the classes, actually!); > - through the Plugins module, which is mix-ined within the Base module > using :extend, have any class nested within the base module to be able > (forced?), everytime they're initialized, to have their instances > :extend the plugins which have registered as callback for the class. > > Not really sure about it, but... > Theoretically it would allow for per-instance :extend, thus overriding > behavior of any instance without the need for aliasing. Same behavior as > my standalone and Josh codes, but same flexibility as my previous gist > attempted to achieve. > > I'll give it a try when I get the time to, unless I'm told this is BS ;) If I understand what you are saying correctly, I've used this exact strategy in the past. I allowed plugins to register themselves on the class object (you can also do that automatically as they are defined with an inherited hook), and then I just extended all instances with the registered plugins as they were created. It worked great and felt very natural to me when using it. James Edward Gray II