4 ms·
Buddy, we're going around in circles here ... Yes, JavaScript lacks a way to easily call "super", but that doesn't mean that the concept doesn't exist. Calling
by jashkenas 15y ago
Buddy, we're going around in circles here ... Yes, JavaScript lacks a way to easily call "super", but that doesn't mean that the concept doesn't exist.
Calling "super" means calling the immediate parent's version of the same function. CoffeeScript is just making it one word:
super
... instead of the usual JavaScript prototype hoop jumping:
Parent.prototype.method.apply(this, arguments);
- MatthewPhillips 15y agoWe're going in circles because I'm talking about design patterns and you're talking about the ability to add features into JS that weren't in mind when it was designed; it can be a lisp if that's what you want. I'll gladly defer to you on what JS is ultimately capable of, it was never the point of my post. Rather my point is that the different syntax is leading to a divergence libraries and frameworks; Batman.js is a great example of a framework that, while you can consume it from JS, you probably wouldn't want to. Thanks for the fun back and forth.
- jacobolus 15y agoDude, just admit you’re wrong about what kinds of patterns are natural or common in JS and about what was “in mind” when it was created. Here are some popular big JavaScript toolkits/frameworks: Closure Library, YUI, Dojo, Prototype, MooTools, ExtJS, Base2, JavaScriptMVC, Backbone. http://closure-library.googlecode.com/svn/docs/closure_goog_base.js.html http://closure-library.googlecode.com/svn/docs/closure_goog_... http://yuilibrary.com/yui/docs/api/classes/Base.html http://yuilibrary.com/yui/docs/api/classes/Base.html http://livedocs.dojotoolkit.org/dojo/declare http://livedocs.dojotoolkit.org/dojo/declare http://api.prototypejs.org/language/Class/ http://api.prototypejs.org/language/Class/ http://mootools.net/docs/core/Class/Class http://mootools.net/docs/core/Class/Class http://docs.sencha.com/ext-js/4-0/#!/api/Ext.Base http://docs.sencha.com/ext-js/4-0/#!/api/Ext.Base http://base2.googlecode.com/svn/version/1.0.2/doc/base2.html#/doc/!base2.Base http://base2.googlecode.com/svn/version/1.0.2/doc/base2.html... http://javascriptmvc.com/docs.html#!jQuery.Class http://javascriptmvc.com/docs.html#!jQuery.Class http://documentcloud.github.com/backbone/docs/backbone.html#section-135 http://documentcloud.github.com/backbone/docs/backbone.html#... * * * And here are some other helpful resources: http://www.aminutewithbrendan.com/pages/20110216 http://www.aminutewithbrendan.com/pages/20110216 http://www.quora.com/How-was-classical-inheritance-*supposed*-to-be-done-in-ECMAScript-3 http://www.quora.com/How-was-classical-inheritance-*supposed... http://www.2ality.com/2011/06/prototypes-as-classes.html http://www.2ality.com/2011/06/prototypes-as-classes.html http://ejohn.org/blog/simple-javascript-inheritance/ http://ejohn.org/blog/simple-javascript-inheritance/ http://my.safaribooksonline.com/book/programming/javascript/9781449399115/code-reuse-patterns/klass http://my.safaribooksonline.com/book/programming/javascript/... http://javascript.crockford.com/prototypal.html http://javascript.crockford.com/prototypal.html http://bolinfest.com/javascript/inheritance.php http://bolinfest.com/javascript/inheritance.php http://dmitrysoshnikov.com/ecmascript/chapter-7-2-oop-ecmascript-implementation/ http://dmitrysoshnikov.com/ecmascript/chapter-7-2-oop-ecmasc...