Jaybanuan's Blog

どうせまた調べるハメになることをメモしていくブログ

Web IDL

はじめに

Web IDLというものがあることを初めて知ったので、概要をメモしておく。

仕様

こちら。

www.w3.org

正式版の公開が2016年と結構前なので、もしかすると最近のWebブラウザの実装状況は以下の最新のドラフト(?)の方が近いのかも(ただの推測)。

webidl.spec.whatwg.org

仕様に記載してある概要

以下に、仕様書に記載してある概要の原文を引用する。

Abstract

This document defines an interface definition language, Web IDL, that 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.How interfaces described with Web IDL correspond to constructs within ECMAScript execution environments is also detailed in this document.It is expected that newly published specifications reference this document to ensure conforming implementations of interfaces are interoperable.

原文を訳してみたので、以下に記しておく。

概要

このドキュメントでは、Webブラウザで実装するインタフェースを記述するために利用する、Web IDLというインタフェース記述言語を定義します。Web IDLは、Webプラットフォームで一般公開するスクリプトオブジェクトの挙動をより簡単に明示するための多くの機能を備えている、IDLの一種です。Web IDLで記述したインターフェイスが、ECMAScriptの実行環境の中の構成物にどのように対応付けられるかについても、このドキュメントで詳説します。今後新規に公開する仕様に対しては、このドキュメントを参照して、インタフェースに従う実装が相互運用可能だと確認することを期待します。

仕様に記載してあるイントロダクション

以下に、仕様書に記載してあるイントロダクションの原文を引用する。

1. Introduction
This section is informative.

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 the IDL 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 in IDL corresponding to properties on the ECMAScript global object, or the unsigned long IDL type mapping to the Number type in ECMAScript.

This specification defines an IDL language similar to OMG IDL for use by specifications that define interfaces for Web APIs. A number of extensions are given to the IDL to support common functionality that previously must have been written in prose. In addition, precise language bindings for ECMAScript Edition 6 are given.

原文を訳してみたので、以下に記しておく。

1. イントロダクション
このセクションは参考情報です。

W3Cが公開している技術レポートの中で、プログラミング言語インターフェイスについて言及しているものは、大抵の場合はObject Management Groupのインターフェイス定義言語 (IDL:Interface Definition Language) [ OMGIDL ] を利用して解説しています。このIDL は、言語に依存しない方法でインターフェイスを記述する手段を提供します。通常、このようなドキュメントは追加の言語バインディングの付録を含んでおり、その付録でIDLで記述したインターフェイスが特定の言語の構成物にどのように対応するのかを詳しく説明しています。

しかしながら、Web で最も一般的に利用されている言語である ECMAScript に対しての、これらの仕様(訳注:前出の付録のことと思われる)におけるバインディングは、相互運用性の問題が発生するような低い精度で始終記載されています。さらに、それぞれの仕様は同じような基本情報を記述する必要があります。例えばECMAScriptのグローバルなオブジェクトのプロパティに対応付けられるIDLで記述したDOMインターフェイスや、IDLのunsigned long 型からECMAScriptのNumber型へのマッピングなどです。

本仕様は、Web API(訳注:Webブラウザが提供するJavaScriptから呼び出すAPIと思われる)のインターフェースを定義する仕様が利用するための、OMGのIDLによく似たIDL言語を定義します。以前は普通の文章で書かざるを得なかった共通機能(訳注:前出のDOMインタフェースやunsigned logのマッピング等と思われる)に対応するために、IDLは多くの拡張機能を提供しています。さらに、ECMAScript Edition 6の正確な言語バインディングを提供しています。

その他情報

www.slideshare.net