{"issue":{"created_at":"2011-12-14T16:17:20Z","state":"closed","updated_at":"2011-12-14T17:56:37Z","comments":9,"user":{"gravatar_id":"21dbcdbf46f8ee3774c1b9b3efadfa9e","id":181635,"url":"https://api.github.com/users/tbranyen","login":"tbranyen","avatar_url":"https://secure.gravatar.com/avatar/21dbcdbf46f8ee3774c1b9b3efadfa9e?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"body":"Been doing research on extending Backbone and found this interesting bit:\r\n\r\n``` javascript\r\n// Set a convenience property in case the parent's prototype is needed later.\r\nchild.__super__ = parent.prototype;\r\n```\r\n\r\nAt an initial glance it looks as if it could work this `this.__super__.someMethod`, but in reality you must call it off the `constructor` which is assigned directly above.\r\n\r\nThis patch instead places `__super__` on the prototype.\r\n\r\n``` javascript\r\n/* One level of extension, calling Backbone.Model.prototype.initialize */\r\n\r\n// Current\r\nthis.constructor.__super__.initialize.call(this);\r\n\r\n// New\r\nthis.__super__.initialize.call(this);\r\n\r\n// Manually\r\nBackbone.Model.prototype.initialize.call(this);\r\n```\r\n\r\nI figure there must be an intentional reason for why its currently set up the way it is.  Any elaboration would be great.","assignee":null,"id":2554101,"labels":[{"name":"change","color":"27823f","url":"https://api.github.com/repos/documentcloud/backbone/labels/change"}],"pull_request":{"patch_url":"https://github.com/documentcloud/backbone/pull/787.patch","html_url":"https://github.com/documentcloud/backbone/pull/787","diff_url":"https://github.com/documentcloud/backbone/pull/787.diff"},"number":787,"title":"put __super__ on the prototype","html_url":"https://github.com/documentcloud/backbone/issues/787","closed_at":"2011-12-14T16:21:41Z","url":"https://api.github.com/repos/documentcloud/backbone/issues/787","milestone":null},"action":"created","comment":{"created_at":"2011-12-14T17:56:37Z","updated_at":"2011-12-14T17:56:37Z","user":{"gravatar_id":"fc40b1fe79ea6b10825141d86f767354","id":646609,"url":"https://api.github.com/users/yuchi","login":"yuchi","avatar_url":"https://secure.gravatar.com/avatar/fc40b1fe79ea6b10825141d86f767354?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"body":"While @jashkenas said\r\n\r\n> Yes `__super__` is not intended for you to use it directly, as the underscored name implies.\r\n\r\nIMHO it's a super legit use of `__super__`. **But** that should be used only when you don't know what your super class is. If you know it you should call it directly.","id":3145352,"url":"https://api.github.com/repos/documentcloud/backbone/issues/comments/3145352"}}