- From: Cameron McCormack <cam@mcc.id.au>
 - Date: Tue, 22 Mar 2011 11:23:15 +1300
 - To: Robin Berjon <robin@berjon.com>
 - Cc: Mark Watson <watsonm@netflix.com>, public-device-apis@w3.org
 
Robin Berjon:
> Mark is not the first one to be (IMHO understandably) confused by this
> somewhat arcane construct. I know that you already have a lot on your
> plate with WebIDL, but I was wondering if you'd considered some syntax
> to make this more straightforward to specify. Since we don't care
> about Java, I've thought of switching to just Function but I don't
> like losing the ability to specify the callback's signature.
“Care less” rather than “don’t care”, I think.
Someone had proposed adding first class function types to Web IDL, to
avoid having to define an interface for this.  How about (the not quite
first class):
  function void SuccessCB(optional Object obj);
and then SuccessCB can be used as an argument type just like the
interface SuccessCB currently is.
There wouldn’t be a property “SuccessCB” on the global object, so
[NoInterfaceObject] wouldn’t be required.
In other languages where you don’t have functions outside of objects,
like Java, it could get mapped to
  interface SuccessCB {
    void run(Object obj);
  }
i.e. the binding would have to assume a name like “run”, and not take it
from the definition of the function, since we’re not giving it one.
Then we could have a built-in definition to Web IDL, either:
  function any Function(in any... args);
or
  function void Function();
(Probably the former.)
-- 
Cameron McCormack ≝ http://mcc.id.au/
Received on Monday, 21 March 2011 22:24:06 UTC