EDIT: I posted before I thought everything out. Here is a better implementation of what was in my mind: http://stackoverflow.com/questions/3376188/javascript-inheritance-idea-part-2
Okay, so I've seen that the following is bad
function A() {
this.variable = 7;
this.method = function() { alert(this.variable); };
}
alpha = new A();
beta = new A();
because you're duplicating the method for each instance. However, why couldn't you do:
var A = new function() {
this.variable = null;
this.method = function() { alert(this.variable); };
};
var alpha = {variable: 8};
alpha.__proto__ = A;
var beta = {variable: 9};
beta.__proto__ = A;
Then you inherit the methods without wasting memory, and you can specify new instance variables.
Of course, I've never seen this pattern, so what's the obvious reason it's not used?