Jake,

Thank for the feedback. I think the same thing...I think Mixin.js
should probably stop at the instance level rather than focus on the
well-trodden area of class mixins.

If you would like to fork my GitHub project, implement your
constructor method with tests, and submit a pull request, I will
happily review it.

Cheers,

Kevin

On Oct 17, 12:21 pm, Jake Verbaten <[email protected]> wrote:
> On Mon, Oct 17, 2011 at 10:28 AM, kmalakoff <[email protected]> wrote:
> > 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.
>
> I will point out that if your mixing in an aspect in a class you may be
> using the wrong tool, an aspect is functionality that belongs to an object
> not to a class of objects.
>
> I would personally be tempted to say you need to different constructs, a
> mixin (class-level) and an aspect (object-level).
>
> As for the automated way of dealing with mixing in and
> constructors/destructors. I basically combine the
> constructors<https://github.com/Raynos/pd/blob/master/src/pd.js#L50>you
> could do the same for destructors, thus a class level mixin would copy
> properties and methods into a class, then overwrite the constructor and
> destructor of the class with a function combination. To automate this you
> would have to enforce defaults like `proto.constructor` and
> `proto.destructor`
>
>
>
>
>
>
>
>
>
> > 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]

-- 
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]

Reply via email to