News for hackers. Stuff that matters.
Re:Mixins, Forwarding, and Delegation in JavaScript by sfeng on Thursday April 10, 2014 @03:00PM (#7568874)
Particularly if you use coffeescript, mixen can be a more capable option: http://github.hubspot.com/mixen/
Re:Mixins, Forwarding, and Delegation in JavaScript by drderidder on Thursday April 10, 2014 @08:28PM (#7570557)
Really insightful write-up but after reading through those code contortions it made me just want to stick with prototypal inheritance. If you have to go to those lengths to get your code to work, it seems like maybe you're doing it wrong, or using the wrong language...
Re:Mixins, Forwarding, and Delegation in JavaScript by greggman on Thursday April 10, 2014 @10:50PM (#7570987)
I had the opposite reaction. For me this is why I love JavaScript. It makes things I want to do in C++, C#, etc simple and easy.

Meta-programming is almost always scary looking regardless of language. But once written well using it is generally easy and I can ignore it and get back to work.

Re:Mixins, Forwarding, and Delegation in JavaScript by blakehaswell on Friday April 11, 2014 @01:11AM (#7571319)
Agreed. Generally I would argue against combining data and behaviour, for the very same reasons that the author wrote these abstractions.

However, I think there are better methods available. For example I would much prefer to organise related behaviour using Node modules (using Browserify if it’s a client app), which give you an extremely understandable way to group related behaviour AND hide private state.

Re:Mixins, Forwarding, and Delegation in JavaScript by ilcosrn on Thursday April 10, 2014 @11:44PM (#7571120)
You can't avoid dealing with javascript when doing web development. Before you mention something like coffeescript, I have to say first that the mixin, forwarding and delegating code were only several lines long. Compare that to the amount of code used to compile to javascript.
Re:Mixins, Forwarding, and Delegation in JavaScript by peterashford on Thursday April 10, 2014 @10:33PM (#7570944)
Very my much impression. What you can abuse JS to do is impressive and I would never ever want to maintain a codebase that used these tricks.
Re:Mixins, Forwarding, and Delegation in JavaScript by ephemeralgomi on Thursday April 10, 2014 @11:58PM (#7571153)
These aren't "tricks" or "abuse". They're design patterns.
Re:Mixins, Forwarding, and Delegation in JavaScript by jdlshore on Thursday April 10, 2014 @08:53PM (#7570641)
Big improvement over the last one [1]. I learned some things. Looking forward to seeing the next one.

[1] https://news.ycombinator.com/item?id=7496968

Re:Mixins, Forwarding, and Delegation in JavaScript by ifandelse on Friday April 18, 2014 @03:44PM (#7610912)
Loved the post. Very nice & deliberate walk through of the various approaches.
Re:Mixins, Forwarding, and Delegation in JavaScript by mxxx on Thursday April 10, 2014 @07:38PM (#7570385)
Nice and comprehensive article, cheers for the share.
Re:Mixins, Forwarding, and Delegation in JavaScript by enowbi on Thursday April 10, 2014 @10:57PM (#7571011)
angularjs please