Re:John Resig: JavaScript as a First Language
by gliese1337 on Wednesday December 21, 2011 @08:43PM
(#3379960)
Seeing as how one of the arguments for teaching JavaScript first is that it lets you teach about prototypical inheritance before the students get used to class-based inheritance, the complexity of simulating a class in JavaScript is probably not the best objection to using it instead of CoffeeScript. If you teach them CoffeeScript, then you will teach them class-based inheritance just like everywhere else, and miss out on the prototype paradigm.
[ Parent
| on HN ]
Re:John Resig: JavaScript as a First Language
by latchkey on Wednesday December 21, 2011 @08:55PM
(#3379994)
I'm ok with missing out on the prototype paradigm. To me, it is a wart for JavaScript. There has been a ton of discussion on why libraries like DateJS, which pollute the Date prototype, are bad.
http://stackoverflow.com/questions/4823682/javascript-namesp...
Re:John Resig: JavaScript as a First Language
by wwweston on Thursday December 22, 2011 @03:23AM
(#3380867)
The discussion you're linking to doesn't appear to discuss either general problems with the prototype paradigm or specific problems with adding properties/methods to the Date prototype.
The closest it seems to come is a warning about not trying to modify the prototype of an object through its __proto__ property (or, I suppose, .getPrototypeOf), which isn't the same thing.
Re:John Resig: JavaScript as a First Language
by Cushman on Wednesday December 21, 2011 @09:17PM
(#3380040)
Personally, I treat the `class` keyword as a useful (and powerful) macro for constructing prototypes.
I imagine if someone thought they were building a 'real' class-based program for too long, they'd be in for a few surprises later on.