W3C home > Mailing lists > Public > public-script-coord@w3.org > July to September 2009

RE: Web IDL Garden Hose

From: Allen Wirfs-Brock <Allen.Wirfs-Brock@microsoft.com>
Date: Wed, 30 Sep 2009 15:50:29 +0000
To: Maciej Stachowiak <mjs@apple.com>, Yehuda Katz <wycats@gmail.com>
CC: "public-script-coord@w3.org" <public-script-coord@w3.org>, "Mark S. Miller" <erights@google.com>, es-discuss Steen <es-discuss@mozilla.org>
Message-ID: <90EDC335A511F2479C63F7337D3CE7DB6BCC96@TK5EX14MBXC116.redmond.corp.microsoft.com>

>-----Original Message-----
>From: Maciej Stachowiak [mailto:mjs@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);
Received on Wednesday, 30 September 2009 15:51:09 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:01 UTC