title: Making native COM methods work as first class citizens in jscript
body: <p>My application is hosting jscript (<code>IActiveScript</code>, IE9). It exports an interface (dual, <code>IDispatch</code>) to it (see below). I can call it from jscript:</p>
  
  <pre><code>host.my_method(42);
  </code></pre>
  
  <p>but passing it to another function (or assigning to a variable) does not work:</p>
  
  <pre><code>function foo(f) { f(42); };
  foo(host.my_method); // error 0x800a138f - Unable to get property 'my_method'
  </code></pre>
  
  <p><strong>Question</strong>: how do I make my native function look like property?</p>
  
  <p>Interface:</p>
  
  <pre><code>[
      object,
      dual,
      uuid(whatever),
      pointer_default(unique)
  ]
  __interface IMyInterface
  {
      [id(1), helpstring("My method")]
      HRESULT my_method([in] VARIANT * value);
  };
  </code></pre>
  
  <p>Here is an implementation of that interface:</p>
  
  <pre><code>[
      coclass,
      event_source(com),
      threading(apartment),
      uuid(guid),
      noncreatable,
      aggregatable(never),
      default(IMyInterface)
  ]
  class MyClass :
      public CComObjectRootEx&lt;....&gt;,
      public CComCoClass&lt;MyClass&gt;,
      public IDispatchImpl&lt;IMyInterface&gt;,
      public IProvideClassInfo2Impl&lt;....&gt;
  {
      ...
      STDMETHOD(my_method)(/*[in]*/ VARIANT * value) override;
  };
  </code></pre>