Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

super access for javascript programmers #1823

Closed
abrahamD opened this issue Nov 15, 2012 · 7 comments
Closed

super access for javascript programmers #1823

abrahamD opened this issue Nov 15, 2012 · 7 comments

Comments

@abrahamD
Copy link

Dear Backbone developers,

I have noticed after browsing your issues and pull requests that there is little love for actual javascript developers, in comparison to the coffeescript variety.

I have been trying to deal with multiple inheritance between objects for some time now and although the recommended method for accessing the super class works, it's not what I would call convenient.

I added a single line after the coffeescript convenience property to tend to this. This solution should not affect the coffeescript convenience and simply make actual javascript development easier.

Here is an example usage: http://jsfiddle.net/yARDp/37/

@caseywebdev
Copy link
Collaborator

I would bet most people who use Backbone don't use CoffeeScript (though I do =p). This is easily something you can subclass.

var MyModel = Backbone.Model.extend({
  constructor: function() {
    (this.base = this.constructor.__super__).constructor.apply(this, arguments);
  }
});
var Vehicle = MyModel.extend({...}); // this.base is accessible
var Car = Vehicle.extend({...}); // same here

@philfreo
Copy link
Contributor

While I would also like to see some support put into backbone core (since it was for coffeescript), I've been using https://github.com/lukasolson/Backbone-Super with some good success (can call this.super() in any function)

@abrahamD
Copy link
Author

Thanks for the answers guys, but I know this stuff already. I'm just posting this as a feature request/Pull request since I find it appalling that I should link some 70 lines of code (Backbone-Super) to my project to compensate for a single unwritten line on BB's part.

@caseywebdev
Copy link
Collaborator

This is why I subclass the Backbone vanilla classes for all of my projects, and I think that's the point of Backbone. Little changes like this are easily accomplished without interfering with others' ideas of how the vanilla class should be (see my example above).

And if you still want to get this in the core I would set up a proper pull request so merging is just a click away.

@abrahamD
Copy link
Author

Again, I am not looking for a solution to this. It's been dealt with already. And it's not a question of how the original class should be rather than why is it accommodating another language before javascript. Right now, line 1465 of the development version of Backbone is there only to make Coffeescripters' life easier. Why not add a single extra line or even a few more characters to allow Javascript developers the same benefits?

@wookiehangover
Copy link
Collaborator

closing... This has already been discussed at length, primarily in #787

@abrahamD
Copy link
Author

I'll be back..

                       ______
                     <((((((\\\
                     /      . }\
                     ;--..--._|}
  (\                 '--/\--'  )
   \\                | '-'  :'|
    \\               . -==- .-|
     \\               \.__.'   \--._
     [\\          __.--|       //  _/'--.
     \ \\       .'-._ ('-----'/ __/      \
      \ \\     /   __>|      | '--.       |
       \ \\   |   \   |     /    /       /
        \ '\ /     \  |     |  _/       /
         \  \       \ |     | /        /
          \  \      \        /

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants