IDL
This page is under heavy construction, as I am writing this as I digest the XML DOM specification. All are encouraged to contribute. - EricAnderton
What is IDL?
The Interface Description Language is used all over the computer science landscape, especially when concepts are described in a language-neutral way. It is also used directly by some languages and compilers as a means of describing an interface with an external system (like in CORBA). One can describe a binary interface for two systems, written in completely different languages, in IDL and expect them to inter-operate.
Converting from IDL to D
So you want to implement an IDL module or interface in D? The process is actually very straightforward, and can be done about 90% via search-and-replace.
At first glance, IDL looks a lot like D. IDL has support for typedefs and interfaces, and even predefined Object and Exception types.
IDL has several attributes that D doesn't have. Coping with these differences usually means altering your interfaces slightly to adopt the behavior specified in the IDL version.
- readonly attribute - Read-only attributes can be best emulated via D's 'property method' technique.
- raises(exceptionname) - There is no equivalent for this in D, so just throw it out. You may want to include this bit in your documentation for use later.
|
There are no IDL equivalents for the bit, complex, imaginary, real or cent datatypes. Pointers are also not supported in IDL.
Links
Wikipedia: IDL - http://en.wikipedia.org/wiki/Interface_description_language Example: W3C? XML DOM IDL - http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl/dom.idl
Footnotes
(*) some programmers may recognize this matrix from C/C++ to D type conversions, which are largely the same