Web IDL Garden Hose

Allen Wirfs-Brock Allen.Wirfs-Brock at microsoft.com
Wed Sep 30 08:50:29 PDT 2009

>-----Original Message-----
>From: Maciej Stachowiak [mailto:mjs at apple.com]
>I don't entirely understand this request. The IDL just defines an
>interface. ECMAScript doesn't have a way to declare an interface
>without implementing it. And the actual behavior of most objects
>described with Web IDL interfaces is not implementable in pure
>ECMAScript - not the interface behavior, the actual core behavior. But
>maybe you can help me understand what you want with an example. Here's
>a trivial Web IDL interface, what would count as an ES implementation
>to you:
>interface FooBar {
>     boolean isFoo(DOMString a, long b);
>     boolean isBar(DOMString a, long b);

How about:

var ForBar = { /*Interface*/
   // This object defines a WebIDL interface. Objects compatible with this interface 
   // must implement all of the following properties  in a manner that preserves the
   // pre and post conditions established by the following definitions 
   isFoo: function (a,b) {
      var validated_a=WebIDL.toDOMString(a);
      var validated_b=WebIDL.toLong(b);
      var specifiedresult=WebIDL.performSpecifiedOperation("FooBar.isFoo"),validated_a,validated_b);
      return Boolean(specified_result);
   isBar: function (a,b) {
      var validated_a=WebIDL.toDOMString(a);
      var validated_b=WebIDL.toLong(b);
      var specified_result=WebIDL.performSpecifiedOperation("FooBar.isBar"),validated_a,validated_b);
      return Boolean(specified_result);

More information about the es-discuss mailing list