Hi everyone, OK. One more point of feedback!
I have implemented the API so you need to call Mixin.in(this, NAME) on every instance (In Coffeescript, I typically do constructor: -> super; Mixin.in(this, "")). As Jake pointed out, it is a little strange since after the first mixin, the functions and properties will already be in the class. That said, Mixin.in and Mixin.out also call the initialize and destroy functions on each instance so it seems like a natural requirement. I really couldn't think of an automated way to do this since the most common case is to mixin in the constructor and mixout in the destructor (if needed). Is there a better way to do this for the most common case? eg. automating the initialization and destruction of instances rather than explicit calls. I would like to retain manual control, but maybe there is a case for and a way to implement this automation. I'm partly thinking about class-level mixins although like Jake pointed out, there's existing and simpler ways to do class-level mixins. Cheers, Kevin On Oct 10, 8:56 am, kmalakoff <[email protected]> wrote: > Hi everyone, > > In a personal project, I started using Javascript mixins quite heavily > and recently refactored out the code into a > library:https://github.com/kmalakoff/mixin > > I've been using and improving this over the last 3 months and I'm > really excited about sharing it with the JS community, but I'm not > sure what people think especially since playing around with prototypes > can be frowned upon. > > The only feedback I have received so far is that is might be hard to > debug and seemed a bit complex. For debugging, I implemented a > statistics module to be able to look at memory usage and would argue > that the complexity matches the problem, but I'd like to get some more > feedback! (thank you Angus for suggesting jsmentors) > > Here are three blog posts with examples so you know what I'm trying to > achieve: > > 1)http://braincode.tumblr.com/post/11026285083/mixin-js-the-javascript-... > 2)http://braincode.tumblr.com/post/11100271168/mixin-js-view-with-model... > 3)http://braincode.tumblr.com/post/11265571365/mixin-js-subscriptions-e... > > The above GitHub repository has tests both for the library and for the > initial 7 mixins I released (RefCount, Flags, AutoMemory, > Subscriptions, Timeouts and 2 or Backbone.js) and the working examples > from the blog posts can be found > here:https://github.com/kmalakoff/examples-kmalakoff > > Any feedback would be much appreciated. > > Cheers, > > Kevin -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/[email protected]/ To search via a non-Google archive, visit here: http://www.mail-archive.com/[email protected]/ To unsubscribe from this group, send email to [email protected]
