title: V8 inherited FunctionTemplate not getting updates to the parent FunctionTemplate
body: <p>I'm using V8 to add JavaScript support to an application. For various reasons I can't get into, we need the ability to add methods to a FunctionTemplate, and have those methods appear in any FunctionTemplates that already inherit from it.</p>
  
  <p>For example,</p>
  
  <pre><code>v8::Handle&lt;v8::FunctionTemplate&gt; parent;
  v8::Handle&lt;v8::FunctionTemplate&gt; child;
  child-&gt;Inherit(parent);
  parent-&gt;PrototypeTemplate()-&gt;Set(isolate, "someNewMethod", v8::FunctionTemplate::New(...));
  </code></pre>
  
  <p>Unfortunately, what I'm finding is that when the parent is modified, the children only have the methods that were available at the time of the inheritance, and further, even if I tell the child to reinherit from the parent, it still does not gain the new methods.</p>
  
  <p>Even worse, if I have a relationship like:</p>
  
  <pre><code>v8::FunctionTemplate parent, firstChild;
  firstChild-&gt;Inherit(parent);
  parent-&gt;PrototypeTemplate()-&gt;Set(isolate, "newMethod", FunctionTemplate::New(...));
  v8::FunctionTemplate secondChild;
  secondChild-&gt;Inherit(parent);
  </code></pre>
  
  <p>then instances of <code>secondChild</code> still only have the <code>parent</code> methods that were available at the time that <code>firstChild</code> inherited.</p>
  
  <p>From what I can tell, V8 may be aggressively optimizing the inheritance relationship; objects instanced from the child <code>FunctionTemplate</code>s do not show a prototype chain, and instead just have the methods bound directly to them.  So, I'm thinking that I need to use <code>Object::SetPrototype</code> to do this instead, but every attempt I've made at that either crashes V8, creates a prototype chain where none of the inherited methods are visible, or has the same effective behavior as the <code>FunctionTemplate::Inherit</code> case.</p>
  
  <p>What is the accepted, standard mechanism for providing inherited methods in V8 such that native methods can be added to superclasses?</p>