News for hackers. Stuff that matters.
Re:The Two Pillars of JavaScript: Part 1: How to Escape the ... by pcthrowaway on Saturday December 13, 2014 @08:25AM (#8745128)
I'm honestly really confused by this article, and would love if someone could clarify this for me (no pun intended). The author mentions that classical inheritance is to be avoided and prototypal inheritance is one of the language's best features. Then he goes on to state that the constructor pattern is also to be avoided and suggests that this is something people use in an attempt to use JS in an object-oriented way.

Correct, me if I'm wrong, but using the constructor pattern (and new) in Javascript is the only real way to create an object that has a prototypal link to the constructor function's prototype. So what does this have to do with classical inheritance?

Re:The Two Pillars of JavaScript: Part 1: How to Escape the ... by esailija on Saturday December 13, 2014 @08:45AM (#8745150)
You can also use Object.create, __proto__ setter or a custom abstraction. However the constructor pattern is in practice used everywhere and I find nothing wrong with it, in fact in the next language version it will get first class syntax through the `class` construct. People need to accept that same keywords mean different things in different languages, just because Javascript `this` and `new` are not like Java `this` and new` doesn't make it better or worse.
Re:The Two Pillars of JavaScript: Part 1: How to Escape the ... by pcthrowaway on Saturday December 13, 2014 @10:08AM (#8745311)
Ok, but wouldn't Object.create be more useful for when you are trying to shoehorn classical inheritance into Javascript? I still don't understand why he's implying (if I'm reading correctly) that using constructors is bad because you end up with the gorilla-holding-banana-and-forest problem that (he argues) comes with classical inheritance.
Re:The Two Pillars of JavaScript: Part 1: How to Escape the ... by jimmaswell on Saturday December 13, 2014 @10:54AM (#8745407)
That gorilla-holding-banana-and-forest problem is more of a boogeyman than anything.
Re:The Two Pillars of JavaScript: Part 1: How to Escape the ... by raffomania on Saturday December 13, 2014 @08:44AM (#8745149)