InfoQ

InfoQ

News

My Bookmarks

Login or Register to enable bookmarks for unlimited time.

The content has been bookmarked!

There was an error bookmarking this content! Please retry.

Web IDL: W3C Language Bindings for DOM Specifications Gets a New Name

Posted by Han Xu on Sep 07, 2008

Sections
Architecture & Design,
Development,
Enterprise Architecture
Topics
Specifications ,
SOA
Tags
W3C ,
AJAX
The W3C Web Applications Working Group recently published the working draft of Web IDL which was formerly known as the Language Bindings for DOM Specifications. The working draft defines a syntactic subset of OMG IDL version 3.0 for use by specifications that define interfaces. InfoQ spoke to the specification editor to learn more about the specification and its impact on the Web development community.

The interface definition language defined by the working draft is called Web IDL which can be used to describe interfaces that are intended to be implemented in web browsers. Web IDL is an IDL variant with a number of features that allow the behavior of common script objects in the web platform to be specified more readily. A number of extensions are given to theIDL to support common functionality that previously must have been written in prose. In addition, precise language bindings for ECMAScript 3rd Edition and Java are given. The Introduction part of the document explains the reason for having such a specification:
Technical reports published by the W3C that include programming language interfaces have typically been described using the Object Management Group’s Interface Definition Language (IDL) [OMGIDL]. The IDL provides a means to describe these interfaces in a language independent manner. Usually, additional language binding appendices are included in such documents which detail how the interfaces described with theIDL correspond to constructs in the given language.

However, the bindings in these specifications for the language most commonly used on the web, ECMAScript, are consistently specified with low enough precision as to result in interoperability issues. In addition, each specification must describe the same basic information, such as DOM interfaces described inIDL corresponding to properties on the ECMAScript global object, or the unsigned long IDL type mapping to the Number type in ECMAScript.
Web IDL is intended to specify in detail the language used by W3C specifications to define interfaces, and to provide precise conformance requirements for ECMAScript and Java bindings of such interfaces.
It is expected that the document acts as a guide to implementors of already-published specifications, and that newly published specifications reference this document to ensure conforming implementations of interfaces are interoperable. "It is proving unbelievably helpful in the construction of HTML5." says Ian Hickson, one of the HTML 5 editors. And another specification that will reference Web IDL is XMLHttpRequest Level 2, which was first published in February 25 this year.

Besides some changes in the content, a major change made in this revision is that the title of the document is changed to "Web IDL", which is "a more accurate name for what the document defines (an IDL language and its mapping to two languages), as the document’s previous name gives people an impression that it was applicable only to DOM specifications, not any specification defining an interface with IDL," according to Cameron McCormack, the editor of Web IDL.

Cameron also tells InfoQ how Web IDL would be useful for the Web development community indirectly:
Most DOM-related specifications at the moment have quite high level descriptions of how host objects in ECMAScript that implement particular interfaces should behave. For example, the ECMAScript Language Binding appendix of DOM Level 3 Core describes the ECMAScript binding for DOM Level 3 Core, yet it does not say that Node prototype object is in the prototype chain for an Element object. Various AJAX toolkits rely on this, yet it has not been standardised.

Another example is that it’s not explained how types are coerced when calling functions on host objects. For example, when you do:

circleElement.setAttributeNS(null, 'cx', 2 * 50);

then it’s expected that this behaves like:

circleElement.setAttributeNS(null, 'cx', '100');

since the third argument to setAttributeNS() is a DOMString. This isn’t defined anywhere, but it is widely interoperable behaviour. Web IDL defines how type coercion works like this.
So with Web IDL "imposing stricter requirements on language bindings for other specifications", the Web development community will see a more interoperable world as far as the coherence between standards and between products developed against the same standards is concerned.
  • This article is part of a featured topic series on SOA
do any interpreters support this? by Patrick Mueller Posted
  1. Back to top

    do any interpreters support this?

    by Patrick Mueller

    Seems like this would be most useful if I could get a JS interpreter to read it, and verify the IDL against runtime behaviour. Maybe just in a test mode or something, even. I suppose you could do that via monkey-patch'ing the living daylights out of the code, at runtime. Not sure I'm going to trust someone to just write this stuff by hand, assume they've done it all correctly. Especially if there's a lot of it.

Educational Content

New-age Transactional Systems - Not Your Grandpa's OLTP

John Hugg discusses high volume transaction processing applications with high and low frequency profiles, and how VoltDB can be used for that purpose.

Cool Code

Kevlin Henney examines code samples to see what can be learned from them starting from the premise that one won’t write great code unless he knows how to read it.

Collaboration: At the Extremities of Extreme

Jason Ayers share the observations he made watching a team of developers collaborating in real time on the same code base, pushing XP, pair programming and continuous integration to their extremes.

Yesod Web Framework

Michael Snoyman presents Yesod, a web framework written in Haskell and containing a web server, templating, ORM, libraries (templating, gravatar, etc.).

Transactions without Transactions

Richard Kreuter and Kyle Banker on how to avoid classical RDBMS transactional systems by using compensation mechanisms, transactional messaging or transactional procedures.

Attila Szegedi on JVM and GC Performance Tuning at Twitter

Attila Szegedi talks about performance tuning Java and Scala programs at Twitter: how to approach GC problems, the importance of asynchronous I/O, when to use MySQL/Cassandra/Redis, and much more.

10 tips on how to prevent business value risk

One category of risk that project teams need to ensure they address is business value failure – delivering a product that fails to provide value for the business investor.

Interview: Software Systems Architecture: Working With Stakeholders Using Viewpoints and Perspectives

InfoQ spoke to the authors of Software Systems Architecture on a couple of new topics, the System Context viewpoint and Agile, which have been added to the second edition.