My prototypical example is the following pseudo-code:
var kind = ...;
...
var type = new kind();
...
var person = new type();
...
var john = new person();
But the problem here is that type is not a function so new type() won't work.
Is there an specific property that you can add to an object to make it acceptable to new?
What most matters to me is the prototype chain, that is what matters for me, that is person.[[Prototype]] should be type, etc, in case that is not possible with new.
Creating a subtyping chain is not an option. Here type is the meta-type of person, not its supertype. Likewise kind is a meta-meta-type. The following tests may clarify the requirements:
When all done, I want these positive tests:
console.log(john instanceof person);   // should be true
console.log(person instanceof type);   // should be true
console.log(type instanceof kind);     // should be true
and these negative tests:
console.log(john instanceof type);     // should be false
console.log(john instanceof kind);     // should be false
console.log(person instanceof kind);   // should be false
I hear that by assigning to the __proto__ property one can do some magic of this sort, but don't know how. Obviously a portable solution (by using Object.create for example) is much preferred, if there is one.
 
     
     
     
     
    