I'm currently working on a project where the following inheritance structure is used:
var Type = function(a){
  this.a = a;
};
var SubType = function(a){
  Type.call(this, a);
};
SubType.prototype = Object.create(Type.prototype);
SubType.prototype.constructor = SubType;
Now, I'm trying add some object pooling to the equation. The pattern I'm currently using works something like (pseudocode):
Type.new = function(){
  if object available in pool
    reset popped pool object 
    return pool object
  else
    return new Type()
}
var a = Type.new();
Of course, the problem with using these two patterns is that constructor calls on SubType wont draw from Type's pool. Is there a way around this without moving to a factory structure? I.e. is there a way, in a constructor, to do something along the lines of:
var SubType = function(){
  build on top of instanceReturnedFromFunction()
};
Knowing it's not always consistent across contexts, I'd would also like to preserve the inheritance structure so that instanceof etc will still work: