News for hackers. Stuff that matters.
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.